From 98c46333428b8a03640446aae14b9493eca889e5 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 12:29:35 +0100 Subject: [PATCH 01/23] scaffold: module supplier --dep bank --- api/poktroll/supplier/genesis.pulsar.go | 596 ++++++++ api/poktroll/supplier/module/module.pulsar.go | 579 ++++++++ api/poktroll/supplier/params.pulsar.go | 500 +++++++ api/poktroll/supplier/query.pulsar.go | 1011 +++++++++++++ api/poktroll/supplier/tx.pulsar.go | 1090 ++++++++++++++ app/app.go | 1284 ++++------------- app/app_config.go | 326 +++++ proto/pocket/supplier/genesis.proto | 16 - proto/pocket/supplier/params.proto | 13 - proto/pocket/supplier/query.proto | 124 -- proto/pocket/supplier/tx.proto | 63 - proto/poktroll/supplier/genesis.proto | 17 + proto/poktroll/supplier/module/module.proto | 14 + proto/poktroll/supplier/params.proto | 15 + proto/poktroll/supplier/query.proto | 30 + proto/poktroll/supplier/tx.proto | 40 + testutil/keeper/supplier.go | 85 +- x/supplier/keeper/keeper.go | 56 +- x/supplier/keeper/msg_server_test.go | 10 +- x/supplier/keeper/msg_update_params.go | 23 + x/supplier/keeper/msg_update_params_test.go | 64 + x/supplier/keeper/params.go | 26 +- x/supplier/keeper/params_test.go | 7 +- x/supplier/keeper/query_params_test.go | 10 +- x/supplier/module/autocli.go | 35 + x/supplier/module/genesis.go | 24 + x/supplier/module/genesis_test.go | 29 + x/supplier/module/module.go | 215 +++ x/supplier/module/simulation.go | 64 + x/supplier/types/codec.go | 27 +- x/supplier/types/errors.go | 17 +- x/supplier/types/expected_keepers.go | 21 +- x/supplier/types/genesis.go | 45 +- x/supplier/types/genesis_test.go | 273 +--- x/supplier/types/keys.go | 22 +- x/supplier/types/msg_update_params.go | 21 + x/supplier/types/params.go | 7 - 37 files changed, 5092 insertions(+), 1707 deletions(-) create mode 100644 api/poktroll/supplier/genesis.pulsar.go create mode 100644 api/poktroll/supplier/module/module.pulsar.go create mode 100644 api/poktroll/supplier/params.pulsar.go create mode 100644 api/poktroll/supplier/query.pulsar.go create mode 100644 api/poktroll/supplier/tx.pulsar.go create mode 100644 app/app_config.go delete mode 100644 proto/pocket/supplier/genesis.proto delete mode 100644 proto/pocket/supplier/params.proto delete mode 100644 proto/pocket/supplier/query.proto delete mode 100644 proto/pocket/supplier/tx.proto create mode 100644 proto/poktroll/supplier/genesis.proto create mode 100644 proto/poktroll/supplier/module/module.proto create mode 100644 proto/poktroll/supplier/params.proto create mode 100644 proto/poktroll/supplier/query.proto create mode 100644 proto/poktroll/supplier/tx.proto create mode 100644 x/supplier/keeper/msg_update_params.go create mode 100644 x/supplier/keeper/msg_update_params_test.go create mode 100644 x/supplier/module/autocli.go create mode 100644 x/supplier/module/genesis.go create mode 100644 x/supplier/module/genesis_test.go create mode 100644 x/supplier/module/module.go create mode 100644 x/supplier/module/simulation.go create mode 100644 x/supplier/types/msg_update_params.go diff --git a/api/poktroll/supplier/genesis.pulsar.go b/api/poktroll/supplier/genesis.pulsar.go new file mode 100644 index 000000000..dc9fea872 --- /dev/null +++ b/api/poktroll/supplier/genesis.pulsar.go @@ -0,0 +1,596 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +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_supplier_genesis_proto_init() + md_GenesisState = File_poktroll_supplier_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_supplier_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.supplier.GenesisState.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.GenesisState.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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/supplier/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 supplier 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_supplier_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_supplier_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_supplier_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4c, 0x0a, + 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x15, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, + 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_genesis_proto_rawDescOnce sync.Once + file_poktroll_supplier_genesis_proto_rawDescData = file_poktroll_supplier_genesis_proto_rawDesc +) + +func file_poktroll_supplier_genesis_proto_rawDescGZIP() []byte { + file_poktroll_supplier_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_genesis_proto_rawDescData) + }) + return file_poktroll_supplier_genesis_proto_rawDescData +} + +var file_poktroll_supplier_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.supplier.GenesisState + (*Params)(nil), // 1: poktroll.supplier.Params +} +var file_poktroll_supplier_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.supplier.GenesisState.params:type_name -> poktroll.supplier.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_supplier_genesis_proto_init() } +func file_poktroll_supplier_genesis_proto_init() { + if File_poktroll_supplier_genesis_proto != nil { + return + } + file_poktroll_supplier_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_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_supplier_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_genesis_proto_depIdxs, + MessageInfos: file_poktroll_supplier_genesis_proto_msgTypes, + }.Build() + File_poktroll_supplier_genesis_proto = out.File + file_poktroll_supplier_genesis_proto_rawDesc = nil + file_poktroll_supplier_genesis_proto_goTypes = nil + file_poktroll_supplier_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/module/module.pulsar.go b/api/poktroll/supplier/module/module.pulsar.go new file mode 100644 index 000000000..4da01a712 --- /dev/null +++ b/api/poktroll/supplier/module/module.pulsar.go @@ -0,0 +1,579 @@ +// 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_supplier_module_module_proto_init() + md_Module = File_poktroll_supplier_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_supplier_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.supplier.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.supplier.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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/supplier/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_supplier_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_supplier_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_supplier_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_module_module_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x5b, 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, 0x33, 0xba, 0xc0, 0x96, + 0xda, 0x01, 0x2d, 0x0a, 0x2b, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x42, 0xd8, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x29, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x4d, 0xaa, 0x02, 0x18, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x18, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x24, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_module_module_proto_rawDescOnce sync.Once + file_poktroll_supplier_module_module_proto_rawDescData = file_poktroll_supplier_module_module_proto_rawDesc +) + +func file_poktroll_supplier_module_module_proto_rawDescGZIP() []byte { + file_poktroll_supplier_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_module_module_proto_rawDescData) + }) + return file_poktroll_supplier_module_module_proto_rawDescData +} + +var file_poktroll_supplier_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.supplier.module.Module +} +var file_poktroll_supplier_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_supplier_module_module_proto_init() } +func file_poktroll_supplier_module_module_proto_init() { + if File_poktroll_supplier_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_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_supplier_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_module_module_proto_depIdxs, + MessageInfos: file_poktroll_supplier_module_module_proto_msgTypes, + }.Build() + File_poktroll_supplier_module_module_proto = out.File + file_poktroll_supplier_module_module_proto_rawDesc = nil + file_poktroll_supplier_module_module_proto_goTypes = nil + file_poktroll_supplier_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/params.pulsar.go b/api/poktroll/supplier/params.pulsar.go new file mode 100644 index 000000000..7108db140 --- /dev/null +++ b/api/poktroll/supplier/params.pulsar.go @@ -0,0 +1,500 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +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_supplier_params_proto_init() + md_Params = File_poktroll_supplier_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_supplier_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.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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/supplier/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_supplier_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_supplier_params_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_supplier_params_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_params_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x23, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, + 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xad, 0x01, 0x0a, 0x15, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_params_proto_rawDescOnce sync.Once + file_poktroll_supplier_params_proto_rawDescData = file_poktroll_supplier_params_proto_rawDesc +) + +func file_poktroll_supplier_params_proto_rawDescGZIP() []byte { + file_poktroll_supplier_params_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_params_proto_rawDescData) + }) + return file_poktroll_supplier_params_proto_rawDescData +} + +var file_poktroll_supplier_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.supplier.Params +} +var file_poktroll_supplier_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_params_proto_init() } +func file_poktroll_supplier_params_proto_init() { + if File_poktroll_supplier_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_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_supplier_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_params_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_params_proto_depIdxs, + MessageInfos: file_poktroll_supplier_params_proto_msgTypes, + }.Build() + File_poktroll_supplier_params_proto = out.File + file_poktroll_supplier_params_proto_rawDesc = nil + file_poktroll_supplier_params_proto_goTypes = nil + file_poktroll_supplier_params_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/query.pulsar.go b/api/poktroll/supplier/query.pulsar.go new file mode 100644 index 000000000..16b94d210 --- /dev/null +++ b/api/poktroll/supplier/query.pulsar.go @@ -0,0 +1,1011 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +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_supplier_query_proto_init() + md_QueryParamsRequest = File_poktroll_supplier_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_supplier_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.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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_supplier_query_proto_init() + md_QueryParamsResponse = File_poktroll_supplier_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_supplier_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.supplier.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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/supplier/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_supplier_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_supplier_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_supplier_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_supplier_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_supplier_query_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_query_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x0a, 0x13, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, + 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x32, 0x91, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0xac, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0a, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, + 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_query_proto_rawDescOnce sync.Once + file_poktroll_supplier_query_proto_rawDescData = file_poktroll_supplier_query_proto_rawDesc +) + +func file_poktroll_supplier_query_proto_rawDescGZIP() []byte { + file_poktroll_supplier_query_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_query_proto_rawDescData) + }) + return file_poktroll_supplier_query_proto_rawDescData +} + +var file_poktroll_supplier_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_supplier_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.supplier.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.supplier.QueryParamsResponse + (*Params)(nil), // 2: poktroll.supplier.Params +} +var file_poktroll_supplier_query_proto_depIdxs = []int32{ + 2, // 0: poktroll.supplier.QueryParamsResponse.params:type_name -> poktroll.supplier.Params + 0, // 1: poktroll.supplier.Query.Params:input_type -> poktroll.supplier.QueryParamsRequest + 1, // 2: poktroll.supplier.Query.Params:output_type -> poktroll.supplier.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_supplier_query_proto_init() } +func file_poktroll_supplier_query_proto_init() { + if File_poktroll_supplier_query_proto != nil { + return + } + file_poktroll_supplier_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_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_supplier_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_supplier_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_supplier_query_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_query_proto_depIdxs, + MessageInfos: file_poktroll_supplier_query_proto_msgTypes, + }.Build() + File_poktroll_supplier_query_proto = out.File + file_poktroll_supplier_query_proto_rawDesc = nil + file_poktroll_supplier_query_proto_goTypes = nil + file_poktroll_supplier_query_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go new file mode 100644 index 000000000..91020fcfe --- /dev/null +++ b/api/poktroll/supplier/tx.pulsar.go @@ -0,0 +1,1090 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +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_supplier_tx_proto_init() + md_MsgUpdateParams = File_poktroll_supplier_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_supplier_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.supplier.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.supplier.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.supplier.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.supplier.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.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.supplier.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.supplier.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.supplier.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.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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_supplier_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_supplier_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_supplier_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.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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/supplier/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the 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_supplier_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{1} +} + +var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_tx_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, + 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 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, 0x1e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 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, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x6c, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, + 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_tx_proto_rawDescOnce sync.Once + file_poktroll_supplier_tx_proto_rawDescData = file_poktroll_supplier_tx_proto_rawDesc +) + +func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { + file_poktroll_supplier_tx_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_tx_proto_rawDescData) + }) + return file_poktroll_supplier_tx_proto_rawDescData +} + +var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse + (*Params)(nil), // 2: poktroll.supplier.Params +} +var file_poktroll_supplier_tx_proto_depIdxs = []int32{ + 2, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params + 0, // 1: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 1, // 2: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.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_supplier_tx_proto_init() } +func file_poktroll_supplier_tx_proto_init() { + if File_poktroll_supplier_tx_proto != nil { + return + } + file_poktroll_supplier_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_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_supplier_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_supplier_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_supplier_tx_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_tx_proto_depIdxs, + MessageInfos: file_poktroll_supplier_tx_proto_msgTypes, + }.Build() + File_poktroll_supplier_tx_proto = out.File + file_poktroll_supplier_tx_proto_rawDesc = nil + file_poktroll_supplier_tx_proto_goTypes = nil + file_poktroll_supplier_tx_proto_depIdxs = nil +} diff --git a/app/app.go b/app/app.go index 68f834d0b..5c5dbf2fb 100644 --- a/app/app.go +++ b/app/app.go @@ -1,225 +1,75 @@ package app import ( - "encoding/json" - "fmt" "io" "os" "path/filepath" - // this line is used by starport scaffolding # stargate/app/moduleImport - - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmos "github.com/cometbft/cometbft/libs/os" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" + "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" + testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - "github.com/cosmos/cosmos-sdk/x/crisis" + consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - appparams "github.com/pokt-network/poktroll/app/params" - "github.com/pokt-network/poktroll/docs" - applicationmodule "github.com/pokt-network/poktroll/x/application" - applicationmodulekeeper "github.com/pokt-network/poktroll/x/application/keeper" - applicationmoduletypes "github.com/pokt-network/poktroll/x/application/types" - gatewaymodule "github.com/pokt-network/poktroll/x/gateway" - gatewaymodulekeeper "github.com/pokt-network/poktroll/x/gateway/keeper" - gatewaymoduletypes "github.com/pokt-network/poktroll/x/gateway/types" - pocketmodule "github.com/pokt-network/poktroll/x/pocket" - pocketmodulekeeper "github.com/pokt-network/poktroll/x/pocket/keeper" - pocketmoduletypes "github.com/pokt-network/poktroll/x/pocket/types" - servicemodule "github.com/pokt-network/poktroll/x/service" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + servicemodulekeeper "github.com/pokt-network/poktroll/x/service/keeper" - servicemoduletypes "github.com/pokt-network/poktroll/x/service/types" - sessionmodule "github.com/pokt-network/poktroll/x/session" - sessionmodulekeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessionmoduletypes "github.com/pokt-network/poktroll/x/session/types" - suppliermodule "github.com/pokt-network/poktroll/x/supplier" suppliermodulekeeper "github.com/pokt-network/poktroll/x/supplier/keeper" - suppliermoduletypes "github.com/pokt-network/poktroll/x/supplier/types" - tokenomicsmodule "github.com/pokt-network/poktroll/x/tokenomics" - tokenomicsmodulekeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" - tokenomicsmoduletypes "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/spf13/cast" + // this line is used by starport scaffolding # stargate/app/moduleImport + + "github.com/pokt-network/poktroll/docs" ) const ( AccountAddressPrefix = "pokt" - Name = "pocket" + Name = "poktroll" // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase DenomuPOKT = "upokt" ) -// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals - -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - // this line is used by starport scaffolding # stargate/app/govProposalHandlers - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - // this line is used by starport scaffolding # stargate/app/govProposalHandler - ) - - return govProposalHandlers -} - var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - // TODO_DISCUSS: Should we rename all instances of `Validator` to `Sequencer`? - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic(getGovProposalHandlers()), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - solomachine.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - ica.AppModuleBasic{}, - vesting.AppModuleBasic{}, - consensus.AppModuleBasic{}, - pocketmodule.AppModuleBasic{}, - servicemodule.AppModuleBasic{}, - sessionmodule.AppModuleBasic{}, - applicationmodule.AppModuleBasic{}, - suppliermodule.AppModuleBasic{}, - gatewaymodule.AppModuleBasic{}, - tokenomicsmodule.AppModuleBasic{}, - // this line is used by starport scaffolding # stargate/app/moduleBasic - ) - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - icatypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - suppliermoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - servicemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - applicationmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - gatewaymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - tokenomicsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - // this line is used by starport scaffolding # stargate/app/maccPerms - } ) var ( @@ -227,792 +77,282 @@ var ( _ servertypes.Application = (*App)(nil) ) -func init() { - userHomeDir, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) -} - // App extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. type App struct { - *baseapp.BaseApp - - cdc *codec.LegacyAmino + *runtime.App + legacyAmino *codec.LegacyAmino appCodec codec.Codec - interfaceRegistry types.InterfaceRegistry txConfig client.TxConfig - - invCheckPeriod uint - - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - memKeys map[string]*storetypes.MemoryStoreKey + interfaceRegistry codectypes.InterfaceRegistry // keepers AccountKeeper authkeeper.AccountKeeper - AuthzKeeper authzkeeper.Keeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper + GovKeeper *govkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + AuthzKeeper authzkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper - ICAHostKeeper icahostkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper - ConsensusParamsKeeper consensusparamkeeper.Keeper + ConsensusParamsKeeper consensuskeeper.Keeper + CircuitBreakerKeeper circuitkeeper.Keeper + + // IBC + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + CapabilityKeeper *capabilitykeeper.Keeper + IBCFeeKeeper ibcfeekeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + + // Scoped IBC + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + + ServiceKeeper servicemodulekeeper.Keeper + SupplierKeeper suppliermodulekeeper.Keeper + // this line is used by starport scaffolding # stargate/app/keeperDeclaration + + // simulation manager + sm *module.SimulationManager +} - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } - PocketKeeper pocketmodulekeeper.Keeper - ServiceKeeper servicemodulekeeper.Keeper - SessionKeeper sessionmodulekeeper.Keeper - ApplicationKeeper applicationmodulekeeper.Keeper - SupplierKeeper suppliermodulekeeper.Keeper + DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) +} - GatewayKeeper gatewaymodulekeeper.Keeper +// getGovProposalHandlers return the chain proposal handlers. +func getGovProposalHandlers() []govclient.ProposalHandler { + var govProposalHandlers []govclient.ProposalHandler + // this line is used by starport scaffolding # stargate/app/govProposalHandlers - TokenomicsKeeper tokenomicsmodulekeeper.Keeper - // this line is used by starport scaffolding # stargate/app/keeperDeclaration + govProposalHandlers = append(govProposalHandlers, + paramsclient.ProposalHandler, + // this line is used by starport scaffolding # stargate/app/govProposalHandler + ) - // mm is the module manager - mm *module.Manager + return govProposalHandlers +} - // sm is the simulation manager - sm *module.SimulationManager - configurator module.Configurator +// AppConfig returns the default app config. +func AppConfig() depinject.Config { + return depinject.Configs( + appConfig, + // Loads the ao config from a YAML file. + // appconfig.LoadYAML(AppConfigYAML), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + // this line is used by starport scaffolding # stargate/appConfig/moduleBasic + }, + ), + ) } -// New returns a reference to an initialized blockchain app +// New returns a reference to an initialized App. func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, - skipUpgradeHeights map[int64]bool, - homePath string, - invCheckPeriod uint, - encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) *App { - appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - txConfig := encodingConfig.TxConfig - - bApp := baseapp.NewBaseApp( - Name, - logger, - db, - encodingConfig.TxConfig.TxDecoder(), - baseAppOptions..., - ) - bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetVersion(version.Version) - bApp.SetInterfaceRegistry(interfaceRegistry) - bApp.SetTxEncoder(txConfig.TxEncoder()) - - keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, authz.ModuleName, banktypes.StoreKey, stakingtypes.StoreKey, - crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, - feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, - capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey, - pocketmoduletypes.StoreKey, - servicemoduletypes.StoreKey, - sessionmoduletypes.StoreKey, - applicationmoduletypes.StoreKey, - suppliermoduletypes.StoreKey, - gatewaymoduletypes.StoreKey, - tokenomicsmoduletypes.StoreKey, - // this line is used by starport scaffolding # stargate/app/storeKey - ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - - // TODO_BLOCKER(#322): Change this to `authtypes.NewModuleAddress(govtypes.ModuleName)` - // once we figure out the MVP for on-chain parameter governance. - pnfAddress := "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw" - authority := pnfAddress - - app := &App{ - BaseApp: bApp, - cdc: cdc, - appCodec: appCodec, - interfaceRegistry: interfaceRegistry, - txConfig: encodingConfig.TxConfig, - invCheckPeriod: invCheckPeriod, - keys: keys, - tkeys: tkeys, - memKeys: memKeys, +) (*App, error) { + var ( + app = &App{} + appBuilder *runtime.AppBuilder + + // merge the AppConfig and other configuration in one config + // TODO_BLOCKER(@Olshansk): Revisit the advanced configuration and understand if/where it fits in Shannon + appConfig = depinject.Configs( + AppConfig(), + depinject.Supply( + // Supply the application options + appOpts, + // Supply with IBC keeper getter for the IBC modules with App Wiring. + // The IBC Keeper cannot be passed because it has not been initiated yet. + // Passing the getter, the app IBC Keeper will always be accessible. + // This needs to be removed after IBC supports App Wiring. + app.GetIBCKeeper, + app.GetCapabilityScopedKeeper, + // Supply the logger + logger, + + // ADVANCED CONFIGURATION + // + // AUTH + // + // For providing a custom function required in auth to generate custom account types + // add it below. By default the auth module uses simulation.RandomGenesisAccounts. + // + // authtypes.RandomGenesisAccountsFn(simulation.RandomGenesisAccounts), + // + // For providing a custom a base account type add it below. + // By default the auth module uses authtypes.ProtoBaseAccount(). + // + // func() sdk.AccountI { return authtypes.ProtoBaseAccount() }, + // + // For providing a different address codec, add it below. + // By default the auth module uses a Bech32 address codec, + // with the prefix defined in the auth module configuration. + // + // func() address.Codec { return <- custom address codec type -> } + + // + // STAKING + // + // For provinding a different validator and consensus address codec, add it below. + // By default the staking module uses the bech32 prefix provided in the auth config, + // and appends "valoper" and "valcons" for validator and consensus addresses respectively. + // When providing a custom address codec in auth, custom address codecs must be provided here as well. + // + // func() runtime.ValidatorAddressCodec { return <- custom validator address codec type -> } + // func() runtime.ConsensusAddressCodec { return <- custom consensus address codec type -> } + + // + // MINT + // + + // For providing a custom inflation function for x/mint add here your + // custom function that implements the minttypes.InflationCalculationFn + // interface. + ), + ) + ) + + if err := depinject.Inject(appConfig, + &appBuilder, + &app.appCodec, + &app.legacyAmino, + &app.txConfig, + &app.interfaceRegistry, + &app.AccountKeeper, + &app.BankKeeper, + &app.StakingKeeper, + &app.SlashingKeeper, + &app.MintKeeper, + &app.DistrKeeper, + &app.GovKeeper, + &app.CrisisKeeper, + &app.UpgradeKeeper, + &app.ParamsKeeper, + &app.AuthzKeeper, + &app.EvidenceKeeper, + &app.FeeGrantKeeper, + &app.GroupKeeper, + &app.ConsensusParamsKeeper, + &app.CircuitBreakerKeeper, + &app.ServiceKeeper, + &app.SupplierKeeper, + // this line is used by starport scaffolding # stargate/app/keeperDefinition + ); err != nil { + panic(err) } - app.ParamsKeeper = initParamsKeeper( - appCodec, - cdc, - keys[paramstypes.StoreKey], - tkeys[paramstypes.TStoreKey], - ) - - // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( - appCodec, - keys[upgradetypes.StoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - bApp.SetParamStore(&app.ConsensusParamsKeeper) - - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper( - appCodec, - keys[capabilitytypes.StoreKey], - memKeys[capabilitytypes.MemStoreKey], - ) - - // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - // this line is used by starport scaffolding # stargate/app/scopedKeeper - - // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper( - appCodec, - keys[authtypes.StoreKey], - authtypes.ProtoBaseAccount, - maccPerms, - sdk.Bech32PrefixAccAddr, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.AuthzKeeper = authzkeeper.NewKeeper( - keys[authz.ModuleName], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - ) - - app.BankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - keys[banktypes.StoreKey], - app.AccountKeeper, - app.BlockedModuleAccountAddrs(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, - keys[stakingtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.FeeGrantKeeper = feegrantkeeper.NewKeeper( - appCodec, - keys[feegrant.StoreKey], - app.AccountKeeper, - ) - - app.MintKeeper = mintkeeper.NewKeeper( - appCodec, - keys[minttypes.StoreKey], - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.DistrKeeper = distrkeeper.NewKeeper( - appCodec, - keys[distrtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, - cdc, - keys[slashingtypes.StoreKey], - app.StakingKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.CrisisKeeper = crisiskeeper.NewKeeper( - appCodec, - keys[crisistypes.StoreKey], - invCheckPeriod, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - groupConfig := group.DefaultConfig() - /* - Example of setting group params: - groupConfig.MaxMetadataLen = 1000 - */ - app.GroupKeeper = groupkeeper.NewKeeper( - keys[group.StoreKey], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - groupConfig, - ) - - app.UpgradeKeeper = upgradekeeper.NewKeeper( - skipUpgradeHeights, - keys[upgradetypes.StoreKey], - appCodec, - homePath, - app.BaseApp, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - // ... other modules keepers - - // Create IBC Keeper - app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], - app.GetSubspace(ibcexported.ModuleName), - app.StakingKeeper, - app.UpgradeKeeper, - scopedIBCKeeper, - ) - - // Create Transfer Keepers - app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, - keys[ibctransfertypes.StoreKey], - app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - scopedTransferKeeper, - ) - transferModule := transfer.NewAppModule(app.TransferKeeper) - transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) - - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], - app.GetSubspace(icahosttypes.SubModuleName), - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), - ) - icaControllerKeeper := icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], - app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), - ) - icaModule := ica.NewAppModule(&icaControllerKeeper, &app.ICAHostKeeper) - icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) - - // Create evidence Keeper for to register the IBC light client misbehaviour evidence route - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, - keys[evidencetypes.StoreKey], - app.StakingKeeper, - app.SlashingKeeper, - ) - // If evidence needs to be handled for the app, set routes in router here and seal - app.EvidenceKeeper = *evidenceKeeper - - govConfig := govtypes.DefaultConfig() - govKeeper := govkeeper.NewKeeper( - appCodec, - keys[govtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.MsgServiceRouter(), - govConfig, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - govRouter := govv1beta1.NewRouter() - govRouter. - AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - govKeeper.SetLegacyRouter(govRouter) - - app.GovKeeper = *govKeeper.SetHooks( - govtypes.NewMultiGovHooks( - // register the governance hooks - ), - ) - - app.PocketKeeper = *pocketmodulekeeper.NewKeeper( - appCodec, - keys[pocketmoduletypes.StoreKey], - keys[pocketmoduletypes.MemStoreKey], - app.GetSubspace(pocketmoduletypes.ModuleName), - ) - pocketModule := pocketmodule.NewAppModule(appCodec, app.PocketKeeper, app.AccountKeeper, app.BankKeeper) - - app.ServiceKeeper = *servicemodulekeeper.NewKeeper( - appCodec, - keys[servicemoduletypes.StoreKey], - keys[servicemoduletypes.MemStoreKey], - app.GetSubspace(servicemoduletypes.ModuleName), - - app.BankKeeper, - ) - serviceModule := servicemodule.NewAppModule(appCodec, app.ServiceKeeper, app.AccountKeeper, app.BankKeeper) - - app.GatewayKeeper = *gatewaymodulekeeper.NewKeeper( - appCodec, - keys[gatewaymoduletypes.StoreKey], - keys[gatewaymoduletypes.MemStoreKey], - app.GetSubspace(gatewaymoduletypes.ModuleName), - - app.BankKeeper, - ) - gatewayModule := gatewaymodule.NewAppModule(appCodec, app.GatewayKeeper, app.AccountKeeper, app.BankKeeper) - - app.ApplicationKeeper = *applicationmodulekeeper.NewKeeper( - appCodec, - keys[applicationmoduletypes.StoreKey], - keys[applicationmoduletypes.MemStoreKey], - app.GetSubspace(applicationmoduletypes.ModuleName), - - app.BankKeeper, - app.AccountKeeper, - app.GatewayKeeper, - ) - applicationModule := applicationmodule.NewAppModule( - appCodec, - app.ApplicationKeeper, - app.AccountKeeper, - app.BankKeeper, - ) - - // TODO_TECHDEBT: Evaluate if this NB goes away after we upgrade to cosmos 0.5x - // NB: there is a circular dependency between the supplier and session keepers. - // Because the keepers are values (as opposed to pointers), they are copied - // when passed into their respective module constructor functions. For this - // reason, the existing pattern of ignite-generated keeper/module construction - // must be broken for these keepers and modules. + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. // - // Order of operations: - // 1. Construct supplier keeper - // 2. Construct session keeper - // 3. Provide session keeper to supplier keeper via custom #SupplySessionKeeper method. - // 4. Construct supplier module - // 5. Construct session module - app.SupplierKeeper = *suppliermodulekeeper.NewKeeper( - appCodec, - keys[suppliermoduletypes.StoreKey], - keys[suppliermoduletypes.MemStoreKey], - app.GetSubspace(suppliermoduletypes.ModuleName), - - app.BankKeeper, - ) - - app.SessionKeeper = *sessionmodulekeeper.NewKeeper( - appCodec, - keys[sessionmoduletypes.StoreKey], - keys[sessionmoduletypes.MemStoreKey], - app.GetSubspace(sessionmoduletypes.ModuleName), - - app.ApplicationKeeper, - app.SupplierKeeper, - ) - - app.SupplierKeeper.SupplySessionKeeper(app.SessionKeeper) - - supplierModule := suppliermodule.NewAppModule(appCodec, app.SupplierKeeper, app.AccountKeeper, app.BankKeeper) - sessionModule := sessionmodule.NewAppModule(appCodec, app.SessionKeeper, app.AccountKeeper, app.BankKeeper) - - app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper( - appCodec, - keys[tokenomicsmoduletypes.StoreKey], - keys[tokenomicsmoduletypes.MemStoreKey], - app.GetSubspace(tokenomicsmoduletypes.ModuleName), - app.BankKeeper, - app.ApplicationKeeper, - app.SupplierKeeper, - authority, - ) - tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper) - - // this line is used by starport scaffolding # stargate/app/keeperDefinition - - /**** IBC Routing ****/ - - // Sealing prevents other modules from creating scoped sub-keepers - app.CapabilityKeeper.Seal() - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := ibcporttypes.NewRouter() - ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). - AddRoute(ibctransfertypes.ModuleName, transferIBCModule) - // this line is used by starport scaffolding # ibc/app/router - app.IBCKeeper.SetRouter(ibcRouter) - - /**** Module Hooks ****/ - - // register hooks after all modules have been initialized - - app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - // insert staking hooks receivers here - app.DistrKeeper.Hooks(), - app.SlashingKeeper.Hooks(), - ), - ) - - /**** Module Options ****/ - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - // NOTE: Any module instantiated in the module manager that is later modified - // must be passed by reference here. - - app.mm = module.NewManager( - genutil.NewAppModule( - app.AccountKeeper, - app.StakingKeeper, - app.BaseApp.DeliverTx, - encodingConfig.TxConfig, - ), - auth.NewAppModule( - appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule( - appCodec, - app.AccountKeeper, - app.BankKeeper, - app.FeeGrantKeeper, - app.interfaceRegistry, - ), - groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - gov.NewAppModule( - appCodec, - &app.GovKeeper, - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(govtypes.ModuleName), - ), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule( - appCodec, - app.SlashingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(slashingtypes.ModuleName), - ), - distr.NewAppModule( - appCodec, - app.DistrKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(distrtypes.ModuleName), - ), - staking.NewAppModule( - appCodec, - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(stakingtypes.ModuleName), - ), - upgrade.NewAppModule(app.UpgradeKeeper), - evidence.NewAppModule(app.EvidenceKeeper), - consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - ibc.NewAppModule(app.IBCKeeper), - params.NewAppModule(app.ParamsKeeper), - transferModule, - icaModule, - pocketModule, - serviceModule, - sessionModule, - applicationModule, - supplierModule, - gatewayModule, - tokenomicsModule, - // this line is used by starport scaffolding # stargate/app/appModule - - crisis.NewAppModule( - app.CrisisKeeper, - skipGenesisInvariants, - app.GetSubspace(crisistypes.ModuleName), - ), // always be last to make sure that it checks for all invariants and not only part of them - ) + // Example: + // + // app.App = appBuilder.Build(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, app.App.BaseApp) + // + // app.App.BaseApp.SetMempool(nonceMempool) + // app.App.BaseApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // app.App.BaseApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to the appBuilder. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) + // + // create and set vote extension handler + // voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtHandler := NewVoteExtensionHandler() + // voteExtHandler.SetHandlers(bApp) + // } - // During begin block slashing happens after distr.BeginBlocker so that - // there is nothing left over in the validator fee pool, so as to keep the - // CanWithdrawInvariant invariant. - // NOTE: staking module is required if HistoricalEntries param > 0 - app.mm.SetOrderBeginBlockers( - // upgrades should be run first - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/beginBlockers - ) + app.App = appBuilder.Build(db, traceStore, baseAppOptions...) - app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/endBlockers - ) + // Register legacy modules + app.registerIBCModules() - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. - genesisModuleOrder := []string{ - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/initGenesis + // register streaming services + if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { + return nil, err } - app.mm.SetOrderInitGenesis(genesisModuleOrder...) - app.mm.SetOrderExportGenesis(genesisModuleOrder...) - // Uncomment if you want to set a custom migration order here. - // app.mm.SetOrderMigrations(custom order) + /**** Module Options ****/ - app.mm.RegisterInvariants(app.CrisisKeeper) - app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.mm.RegisterServices(app.configurator) + app.ModuleManager.RegisterInvariants(app.CrisisKeeper) - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) - reflectionSvc, err := runtimeservices.NewReflectionService() - if err != nil { - panic(err) - } - reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + // add test gRPC service for testing gRPC queries in isolation + testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) // create the simulation manager and define the order of the modules for deterministic simulations + // + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule( - app.appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), } - app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) - app.sm.RegisterStoreDecoders() - - // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memKeys) - - // initialize BaseApp - anteHandler, err := ante.NewAnteHandler( - ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - }, - ) - if err != nil { - panic(fmt.Errorf("failed to create AnteHandler: %w", err)) - } - - app.SetAnteHandler(anteHandler) - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) - app.SetEndBlocker(app.EndBlocker) - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) - } - } - - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - // this line is used by starport scaffolding # stargate/app/beforeInitReturn + app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) - return app -} - -// Name returns the name of the App -func (app *App) Name() string { return app.BaseApp.Name() } - -// BeginBlocker application updates every begin block -func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) -} - -// EndBlocker application updates every end block -func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) -} - -// InitChainer application update at chain initialization -func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - var genesisState GenesisState - if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { - panic(err) - } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) - return app.mm.InitGenesis(ctx, app.appCodec, genesisState) -} - -// Configurator get app configurator -func (app *App) Configurator() module.Configurator { - return app.configurator -} + app.sm.RegisterStoreDecoders() -// LoadHeight loads a particular height -func (app *App) LoadHeight(height int64) error { - return app.LoadVersion(height) -} + // A custom InitChainer can be set if extra pre-init-genesis logic is required. + // By default, when using app wiring enabled module, this is not required. + // For instance, the upgrade module will set automatically the module version map in its init genesis thanks to app wiring. + // However, when registering a module manually (i.e. that does not support app wiring), the module version map + // must be set manually as follow. The upgrade module will de-duplicate the module version map. + // + // app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { + // app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + // return app.App.InitChainer(ctx, req) + // }) -// ModuleAccountAddrs returns all the app's module account addresses. -func (app *App) ModuleAccountAddrs() map[string]bool { - modAccAddrs := make(map[string]bool) - for acc := range maccPerms { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + if err := app.Load(loadLatest); err != nil { + return nil, err } - return modAccAddrs + return app, nil } -// BlockedModuleAccountAddrs returns all the app's blocked module account -// addresses. -func (app *App) BlockedModuleAccountAddrs() map[string]bool { - modAccAddrs := app.ModuleAccountAddrs() - delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - return modAccAddrs -} - -// LegacyAmino returns SimApp's amino codec. +// LegacyAmino returns App's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. func (app *App) LegacyAmino() *codec.LegacyAmino { - return app.cdc + return app.legacyAmino } -// AppCodec returns an app codec. +// AppCodec returns App's app codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. @@ -1020,121 +360,93 @@ func (app *App) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns an InterfaceRegistry -func (app *App) InterfaceRegistry() types.InterfaceRegistry { - return app.interfaceRegistry -} - -// TxConfig returns SimApp's TxConfig -func (app *App) TxConfig() client.TxConfig { - return app.txConfig -} - // GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { - return app.keys[storeKey] + kvStoreKey, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey } -// GetTKey returns the TransientStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey { - return app.tkeys[storeKey] +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key } -// GetMemKey returns the MemStoreKey for the provided mem key. -// -// NOTE: This is solely used for testing purposes. -func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { - return app.memKeys[storeKey] +// kvStoreKeys returns all the kv store keys registered inside App. +func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys } // GetSubspace returns a param subspace for a given module name. -// -// NOTE: This is solely to be used for testing purposes. func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) return subspace } +// SimulationManager implements the SimulationApp interface. +func (app *App) SimulationManager() *module.SimulationManager { + return app.sm +} + // RegisterAPIRoutes registers all application module routes with the provided // API server. func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - // Register new tx routes from grpc-gateway. - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register node gRPC service for grpc-gateway. - nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register grpc-gateway routes for all modules. - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } // register app's OpenAPI routes. docs.RegisterOpenAPIService(Name, apiSvr.Router) } -// RegisterTxService implements the Application.RegisterTxService method. -func (app *App) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +// GetIBCKeeper returns the IBC keeper. +func (app *App) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper } -// RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *App) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService( - clientCtx, - app.BaseApp.GRPCQueryRouter(), - app.interfaceRegistry, - app.Query, - ) +// GetCapabilityScopedKeeper returns the capability scoped keeper. +func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper { + return app.CapabilityKeeper.ScopeToModule(moduleName) } -// RegisterNodeService implements the Application.RegisterNodeService method. -func (app *App) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) -} - -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper( - appCodec codec.BinaryCodec, - legacyAmino *codec.LegacyAmino, - key, tkey storetypes.StoreKey, -) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck - paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - paramsKeeper.Subspace(pocketmoduletypes.ModuleName) - paramsKeeper.Subspace(servicemoduletypes.ModuleName) - paramsKeeper.Subspace(sessionmoduletypes.ModuleName) - paramsKeeper.Subspace(applicationmoduletypes.ModuleName) - paramsKeeper.Subspace(suppliermoduletypes.ModuleName) - paramsKeeper.Subspace(gatewaymoduletypes.ModuleName) - paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName) - // this line is used by starport scaffolding # stargate/app/paramSubspace - - return paramsKeeper -} - -// SimulationManager returns the app SimulationManager -func (app *App) SimulationManager() *module.SimulationManager { - return app.sm +// GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. +func GetMaccPerms() map[string][]string { + dup := make(map[string][]string) + for _, perms := range moduleAccPerms { + dup[perms.Account] = perms.Permissions + } + return dup } -// ModuleManager returns the app ModuleManager -func (app *App) ModuleManager() *module.Manager { - return app.mm +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { + result := make(map[string]bool) + if len(blockAccAddrs) > 0 { + for _, addr := range blockAccAddrs { + result[addr] = true + } + } else { + for addr := range GetMaccPerms() { + result[addr] = true + } + } + return result } diff --git a/app/app_config.go b/app/app_config.go new file mode 100644 index 000000000..4a04b6478 --- /dev/null +++ b/app/app_config.go @@ -0,0 +1,326 @@ +package app + +import ( + "time" + + runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" + appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" + authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" + bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" + circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" + consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" + distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" + evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" + feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" + genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" + govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1" + groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" + mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" + paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" + slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" + stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" + txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" + upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" + vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" + "cosmossdk.io/core/appconfig" + _ "cosmossdk.io/x/circuit" // import for side-effects + circuittypes "cosmossdk.io/x/circuit/types" + _ "cosmossdk.io/x/evidence" // import for side-effects + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + _ "cosmossdk.io/x/feegrant/module" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/runtime" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects + 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" + servicemodulev1 "github.com/pokt-network/poktroll/api/poktroll/service/module" + suppliermodulev1 "github.com/pokt-network/poktroll/api/poktroll/supplier/module" + _ "github.com/pokt-network/poktroll/x/service/module" // import for side-effects + servicemoduletypes "github.com/pokt-network/poktroll/x/service/types" + _ "github.com/pokt-network/poktroll/x/supplier/module" // import for side-effects + suppliermoduletypes "github.com/pokt-network/poktroll/x/supplier/types" + "google.golang.org/protobuf/types/known/durationpb" + // this line is used by starport scaffolding # stargate/app/moduleImport +) + +var ( + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + genesisModuleOrder = []string{ + // cosmos-sdk/ibc modules + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + ibcexported.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + circuittypes.ModuleName, + group.ModuleName, + consensusparamtypes.ModuleName, + circuittypes.ModuleName, + // chain modules + servicemoduletypes.ModuleName, + suppliermoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/initGenesis + } + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + beginBlockers = []string{ + // cosmos sdk modules + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authz.ModuleName, + genutiltypes.ModuleName, + // ibc modules + capabilitytypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + servicemoduletypes.ModuleName, + suppliermoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/beginBlockers + } + + endBlockers = []string{ + // cosmos sdk modules + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, + genutiltypes.ModuleName, + // ibc modules + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + servicemoduletypes.ModuleName, + suppliermoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/endBlockers + } + + preBlockers = []string{ + upgradetypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/preBlockers + } + + // module account permissions + moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ + {Account: authtypes.FeeCollectorName}, + {Account: distrtypes.ModuleName}, + {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, + {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, + {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: ibcfeetypes.ModuleName}, + {Account: icatypes.ModuleName}, + {Account: servicemoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + {Account: suppliermoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + // this line is used by starport scaffolding # stargate/app/maccPerms + } + + // blocked account addresses + blockAccAddrs = []string{ + authtypes.FeeCollectorName, + distrtypes.ModuleName, + minttypes.ModuleName, + stakingtypes.BondedPoolName, + stakingtypes.NotBondedPoolName, + // We allow the following module accounts to receive funds: + // govtypes.ModuleName + } + + // appConfig application configuration (used by depinject) + appConfig = appconfig.Compose(&appv1alpha1.Config{ + Modules: []*appv1alpha1.ModuleConfig{ + { + Name: runtime.ModuleName, + Config: appconfig.WrapAny(&runtimev1alpha1.Module{ + AppName: Name, + PreBlockers: preBlockers, + BeginBlockers: beginBlockers, + EndBlockers: endBlockers, + InitGenesis: genesisModuleOrder, + OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ + { + ModuleName: authtypes.ModuleName, + KvStoreKey: "acc", + }, + }, + // When ExportGenesis is not specified, the export genesis module order + // is equal to the init genesis order + // ExportGenesis: genesisModuleOrder, + // Uncomment if you want to set a custom migration order here. + // OrderMigrations: nil, + }), + }, + { + Name: authtypes.ModuleName, + Config: appconfig.WrapAny(&authmodulev1.Module{ + Bech32Prefix: AccountAddressPrefix, + ModuleAccountPermissions: moduleAccPerms, + // By default modules authority is the governance module. This is configurable with the following: + // Authority: "group", // A custom module authority can be set using a module name + // Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address + }), + }, + { + Name: vestingtypes.ModuleName, + Config: appconfig.WrapAny(&vestingmodulev1.Module{}), + }, + { + Name: banktypes.ModuleName, + Config: appconfig.WrapAny(&bankmodulev1.Module{ + BlockedModuleAccountsOverride: blockAccAddrs, + }), + }, + { + Name: stakingtypes.ModuleName, + Config: appconfig.WrapAny(&stakingmodulev1.Module{ + // NOTE: specifying a prefix is only necessary when using bech32 addresses + // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + Bech32PrefixValidator: AccountAddressPrefix + "valoper", + Bech32PrefixConsensus: AccountAddressPrefix + "valcons", + }), + }, + { + Name: slashingtypes.ModuleName, + Config: appconfig.WrapAny(&slashingmodulev1.Module{}), + }, + { + Name: paramstypes.ModuleName, + Config: appconfig.WrapAny(¶msmodulev1.Module{}), + }, + { + Name: "tx", + Config: appconfig.WrapAny(&txconfigv1.Config{}), + }, + { + Name: genutiltypes.ModuleName, + Config: appconfig.WrapAny(&genutilmodulev1.Module{}), + }, + { + Name: authz.ModuleName, + Config: appconfig.WrapAny(&authzmodulev1.Module{}), + }, + { + Name: upgradetypes.ModuleName, + Config: appconfig.WrapAny(&upgrademodulev1.Module{}), + }, + { + Name: distrtypes.ModuleName, + Config: appconfig.WrapAny(&distrmodulev1.Module{}), + }, + { + Name: evidencetypes.ModuleName, + Config: appconfig.WrapAny(&evidencemodulev1.Module{}), + }, + { + Name: minttypes.ModuleName, + Config: appconfig.WrapAny(&mintmodulev1.Module{}), + }, + { + Name: group.ModuleName, + Config: appconfig.WrapAny(&groupmodulev1.Module{ + MaxExecutionPeriod: durationpb.New(time.Second * 1209600), + MaxMetadataLen: 255, + }), + }, + { + Name: feegrant.ModuleName, + Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), + }, + { + Name: govtypes.ModuleName, + Config: appconfig.WrapAny(&govmodulev1.Module{}), + }, + { + Name: crisistypes.ModuleName, + Config: appconfig.WrapAny(&crisismodulev1.Module{}), + }, + { + Name: consensustypes.ModuleName, + Config: appconfig.WrapAny(&consensusmodulev1.Module{}), + }, + { + Name: circuittypes.ModuleName, + Config: appconfig.WrapAny(&circuitmodulev1.Module{}), + }, + { + Name: servicemoduletypes.ModuleName, + Config: appconfig.WrapAny(&servicemodulev1.Module{}), + }, + { + Name: suppliermoduletypes.ModuleName, + Config: appconfig.WrapAny(&suppliermodulev1.Module{}), + }, + // this line is used by starport scaffolding # stargate/app/moduleConfig + }, + }) +) diff --git a/proto/pocket/supplier/genesis.proto b/proto/pocket/supplier/genesis.proto deleted file mode 100644 index 5bba7baea..000000000 --- a/proto/pocket/supplier/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "gogoproto/gogo.proto"; -import "pocket/supplier/params.proto"; -import "pocket/shared/supplier.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// GenesisState defines the supplier module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated pocket.shared.Supplier supplierList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/supplier/params.proto b/proto/pocket/supplier/params.proto deleted file mode 100644 index 3ea82ce2f..000000000 --- a/proto/pocket/supplier/params.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - // TODO_BLOCKER: Add proof-related submission window params - // TODO_BLOCKER: Add claim-related submission window params -} diff --git a/proto/pocket/supplier/query.proto b/proto/pocket/supplier/query.proto deleted file mode 100644 index ac0bad9de..000000000 --- a/proto/pocket/supplier/query.proto +++ /dev/null @@ -1,124 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/supplier/params.proto"; -import "pocket/shared/supplier.proto"; -import "pocket/supplier/claim.proto"; -import "pocket/supplier/proof.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/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 = "/pocket/supplier/params"; - } - - // Queries a list of Supplier items. - rpc Supplier (QueryGetSupplierRequest) returns (QueryGetSupplierResponse) { - option (google.api.http).get = "/pocket/supplier/supplier/{address}"; - - } - rpc SupplierAll (QueryAllSupplierRequest) returns (QueryAllSupplierResponse) { - option (google.api.http).get = "/pocket/supplier/suppliers"; - } - - // Queries a list of Claim items. - rpc Claim (QueryGetClaimRequest) returns (QueryGetClaimResponse) { - option (google.api.http).get = "/pocket/supplier/claim/{session_id}/{supplier_address}"; - } - rpc AllClaims (QueryAllClaimsRequest) returns (QueryAllClaimsResponse) { - option (google.api.http).get = "/pocket/supplier/claims"; - } - - // Queries a list of Proof items. - rpc Proof (QueryGetProofRequest) returns (QueryGetProofResponse) { - option (google.api.http).get = "/pocket/supplier/proof/{session_id}/{supplier_address}"; - } - rpc AllProofs (QueryAllProofsRequest) returns (QueryAllProofsResponse) { - option (google.api.http).get = "/pocket/supplier/proof"; - } -} - -// 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]; -} - -message QueryGetSupplierRequest { - string address = 1; -} - -message QueryGetSupplierResponse { - pocket.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllSupplierRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllSupplierResponse { - repeated pocket.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryGetClaimRequest { - string session_id = 1; - string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -message QueryGetClaimResponse { - Claim claim = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllClaimsRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - oneof filter { - string supplier_address = 2; - string session_id = 3; - uint64 session_end_height = 4; - } -} - -message QueryAllClaimsResponse { - // TODO_IMPROVE: Rename to `Claims` (plural). - repeated Claim claim = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryGetProofRequest { - string session_id = 1; - string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -message QueryGetProofResponse { - Proof proof = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllProofsRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - oneof filter { - string supplier_address = 2; - string session_id = 3; - uint64 session_end_height = 4; - } -} - -message QueryAllProofsResponse { - // TODO_IMPROVE: Rename to `Proofs` (plural). - repeated Proof proof = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/supplier/tx.proto b/proto/pocket/supplier/tx.proto deleted file mode 100644 index 2671b83a9..000000000 --- a/proto/pocket/supplier/tx.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/msg/v1/msg.proto"; - -import "pocket/session/session.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Msg defines the Msg service. -service Msg { - rpc StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); - rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); - rpc CreateClaim (MsgCreateClaim ) returns (MsgCreateClaimResponse ); - rpc SubmitProof (MsgSubmitProof ) returns (MsgSubmitProofResponse ); -} - -message MsgStakeSupplier { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) - repeated shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for -} - -message MsgStakeSupplierResponse {} - -message MsgUnstakeSupplier { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1; -} - -message MsgUnstakeSupplierResponse {} - -message MsgCreateClaim { - option (cosmos.msg.v1.signer) = "supplier_address"; - - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - pocket.session.SessionHeader session_header = 2; - // root returned from smt.SMST#Root() - bytes root_hash = 3; -} - -message MsgCreateClaimResponse {} - - - -message MsgSubmitProof { - option (cosmos.msg.v1.signer) = "supplier_address"; - - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - pocket.session.SessionHeader session_header = 2; - // serialized version of *smt.SparseMerkleClosestProof - bytes proof = 3; -} - -message MsgSubmitProofResponse {} - diff --git a/proto/poktroll/supplier/genesis.proto b/proto/poktroll/supplier/genesis.proto new file mode 100644 index 000000000..271750d68 --- /dev/null +++ b/proto/poktroll/supplier/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package poktroll.supplier; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/supplier/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + +// GenesisState defines the supplier 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/supplier/module/module.proto b/proto/poktroll/supplier/module/module.proto new file mode 100644 index 000000000..b0b5704db --- /dev/null +++ b/proto/poktroll/supplier/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.supplier.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/supplier" + }; + + // 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/supplier/params.proto b/proto/poktroll/supplier/params.proto new file mode 100644 index 000000000..031afe85a --- /dev/null +++ b/proto/poktroll/supplier/params.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package poktroll.supplier; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/supplier/Params"; + option (gogoproto.equal) = true; + + +} \ No newline at end of file diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto new file mode 100644 index 000000000..a9f01c722 --- /dev/null +++ b/proto/poktroll/supplier/query.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package poktroll.supplier; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/supplier/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/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/supplier/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/supplier/tx.proto b/proto/poktroll/supplier/tx.proto new file mode 100644 index 000000000..6e3498e66 --- /dev/null +++ b/proto/poktroll/supplier/tx.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package poktroll.supplier; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/supplier/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/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/supplier/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/supplier.go b/testutil/keeper/supplier.go index 8bd600c27..3b1fcf575 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.go @@ -3,92 +3,45 @@ package keeper import ( "testing" - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "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/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" + 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/testutil/supplier" - "github.com/pokt-network/poktroll/testutil/supplier/mocks" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) -func SupplierKeeper(t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress) (*keeper.Keeper, sdk.Context) { - t.Helper() +func SupplierKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() 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() - - mockSessionKeeper := mocks.NewMockSessionKeeper(ctrl) - mockSessionKeeper.EXPECT(). - GetSession(gomock.AssignableToTypeOf(sdk.Context{}), gomock.Any()). - DoAndReturn( - func( - ctx sdk.Context, - req *sessiontypes.QueryGetSessionRequest, - ) (*sessiontypes.QueryGetSessionResponse, error) { - session, ok := sessionByAppAddr[req.GetApplicationAddress()] - require.Truef(t, ok, "application address not provided during mock construction: %q", req.ApplicationAddress) - - return &sessiontypes.QueryGetSessionResponse{ - Session: &sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - ApplicationAddress: session.GetApplication().GetAddress(), - Service: req.GetService(), - SessionStartBlockHeight: 1, - SessionId: session.GetSessionId(), - SessionEndBlockHeight: 5, - }, - SessionId: session.GetSessionId(), - SessionNumber: 1, - NumBlocksPerSession: session.GetNumBlocksPerSession(), - Application: session.GetApplication(), - Suppliers: session.GetSuppliers(), - }, - }, nil - }, - ).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "SupplierParams", - ) k := keeper.NewKeeper( cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockBankKeeper, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + nil, ) - k.SupplySessionKeeper(mockSessionKeeper) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params k.SetParams(ctx, types.DefaultParams()) diff --git a/x/supplier/keeper/keeper.go b/x/supplier/keeper/keeper.go index 709c94c30..ef87b8f4d 100644 --- a/x/supplier/keeper/keeper.go +++ b/x/supplier/keeper/keeper.go @@ -3,58 +3,56 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/core/store" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/pokt-network/poktroll/x/supplier/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger - bankKeeper types.BankKeeper - sessionKeeper types.SessionKeeper + // 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, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, + storeService store.KVStoreService, + logger log.Logger, + authority string, bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) } - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, bankKeeper: bankKeeper, } } -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority } -// TODO_TECHDEBT: Evaluate if this is still necessary after the upgrade to cosmos 0.5x -// SupplySessionKeeper assigns the session keeper dependency of this supplier -// keeper. This MUST be done as a separate step from construction because there -// is a circular dependency between the supplier and session keepers. -func (k *Keeper) SupplySessionKeeper(sessionKeeper types.SessionKeeper) { - k.sessionKeeper = sessionKeeper +// 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/supplier/keeper/msg_server_test.go b/x/supplier/keeper/msg_server_test.go index b337090e3..480dd0262 100644 --- a/x/supplier/keeper/msg_server_test.go +++ b/x/supplier/keeper/msg_server_test.go @@ -4,7 +4,6 @@ import ( "context" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" @@ -12,13 +11,14 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.SupplierKeeper(t, nil) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.SupplierKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) + require.NotEmpty(t, k) } diff --git a/x/supplier/keeper/msg_update_params.go b/x/supplier/keeper/msg_update_params.go new file mode 100644 index 000000000..01aaace7c --- /dev/null +++ b/x/supplier/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/supplier/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/supplier/keeper/msg_update_params_test.go b/x/supplier/keeper/msg_update_params_test.go new file mode 100644 index 000000000..2e179b220 --- /dev/null +++ b/x/supplier/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/supplier/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/supplier/keeper/params.go b/x/supplier/keeper/params.go index 86ca01cbe..6e3162e05 100644 --- a/x/supplier/keeper/params.go +++ b/x/supplier/keeper/params.go @@ -1,17 +1,33 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + "github.com/cosmos/cosmos-sdk/runtime" "github.com/pokt-network/poktroll/x/supplier/types" ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +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 sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +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/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go index 38f2e91b9..dac4b01a1 100644 --- a/x/supplier/keeper/params_test.go +++ b/x/supplier/keeper/params_test.go @@ -5,15 +5,14 @@ import ( "github.com/stretchr/testify/require" - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) func TestGetParams(t *testing.T) { - k, ctx := testkeeper.SupplierKeeper(t, nil) + k, ctx := keepertest.SupplierKeeper(t) params := types.DefaultParams() - k.SetParams(ctx, params) - + require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } diff --git a/x/supplier/keeper/query_params_test.go b/x/supplier/keeper/query_params_test.go index 37df8b949..e9014f7b7 100644 --- a/x/supplier/keeper/query_params_test.go +++ b/x/supplier/keeper/query_params_test.go @@ -3,20 +3,18 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) + keeper, ctx := keepertest.SupplierKeeper(t) params := types.DefaultParams() - keeper.SetParams(ctx, params) + require.NoError(t, keeper.SetParams(ctx, params)) - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.Equal(t, &types.QueryParamsResponse{Params: params}, response) } diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go new file mode 100644 index 000000000..737ce98ea --- /dev/null +++ b/x/supplier/module/autocli.go @@ -0,0 +1,35 @@ +package supplier + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/supplier" +) + +// 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/supplier/module/genesis.go b/x/supplier/module/genesis.go new file mode 100644 index 000000000..7c12c8a1d --- /dev/null +++ b/x/supplier/module/genesis.go @@ -0,0 +1,24 @@ +package supplier + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/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/supplier/module/genesis_test.go b/x/supplier/module/genesis_test.go new file mode 100644 index 000000000..3c1559a34 --- /dev/null +++ b/x/supplier/module/genesis_test.go @@ -0,0 +1,29 @@ +package supplier_test + +import ( + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/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.SupplierKeeper(t) + supplier.InitGenesis(ctx, k, genesisState) + got := supplier.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/supplier/module/module.go b/x/supplier/module/module.go new file mode 100644 index 000000000..6cb134ae6 --- /dev/null +++ b/x/supplier/module/module.go @@ -0,0 +1,215 @@ +package supplier + +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/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/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 + + SupplierKeeper 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{SupplierKeeper: k, Module: m} +} diff --git a/x/supplier/module/simulation.go b/x/supplier/module/simulation.go new file mode 100644 index 000000000..67a000511 --- /dev/null +++ b/x/supplier/module/simulation.go @@ -0,0 +1,64 @@ +package supplier + +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" + suppliersimulation "github.com/pokt-network/poktroll/x/supplier/simulation" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// avoid unused import issue +var ( + _ = suppliersimulation.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() + } + supplierGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&supplierGenesis) +} + +// 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/supplier/types/codec.go b/x/supplier/types/codec.go index 5dc59bf31..ac5526374 100644 --- a/x/supplier/types/codec.go +++ b/x/supplier/types/codec.go @@ -1,36 +1,17 @@ package types import ( - "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/msgservice" + // this line is used by starport scaffolding # 1 ) -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeSupplier{}, "supplier/StakeSupplier", nil) - cdc.RegisterConcrete(&MsgUnstakeSupplier{}, "supplier/UnstakeSupplier", nil) - cdc.RegisterConcrete(&MsgCreateClaim{}, "supplier/CreateClaim", nil) - cdc.RegisterConcrete(&MsgSubmitProof{}, "supplier/SubmitProof", nil) - // this line is used by starport scaffolding # 2 -} - func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeSupplier{}, - &MsgUnstakeSupplier{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateClaim{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgSubmitProof{}, + &MsgUpdateParams{}, ) - // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go index 61a56f566..0e998c507 100644 --- a/x/supplier/types/errors.go +++ b/x/supplier/types/errors.go @@ -8,19 +8,6 @@ import ( // x/supplier module sentinel errors var ( - ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") - ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") - ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") - ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") - ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") - ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") - ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") - ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") - ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") - ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") - ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") - ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") - ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") - ErrSupplierInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") - ErrSupplierInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") + 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/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go index f6f8b626c..4a50d01a9 100644 --- a/x/supplier/types/expected_keepers.go +++ b/x/supplier/types/expected_keepers.go @@ -1,28 +1,25 @@ package types -//go:generate mockgen -destination ../../../testutil/supplier/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,SessionKeeper - import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" ) -// AccountKeeper defines the expected account keeper used for simulations (noalias) +// AccountKeeper defines the expected interface for the Account module. type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation // Methods imported from account should be defined here } -// BankKeeper defines the expected interface needed to retrieve account balances. +// 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 + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here } -type SessionKeeper interface { - GetSession(context.Context, *sessiontypes.QueryGetSessionRequest) (*sessiontypes.QueryGetSessionResponse, 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/supplier/types/genesis.go b/x/supplier/types/genesis.go index 9d06b42ff..0af9b4416 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/types/genesis.go @@ -1,13 +1,7 @@ package types import ( - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +// this line is used by starport scaffolding # genesis/types/import ) // DefaultIndex is the default global index @@ -16,7 +10,6 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - SupplierList: []sharedtypes.Supplier{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -25,42 +18,6 @@ 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 supplier - supplierIndexMap := make(map[string]struct{}) - for _, supplier := range gs.SupplierList { - index := string(SupplierKey(supplier.Address)) - if _, ok := supplierIndexMap[index]; ok { - return fmt.Errorf("duplicated index for supplier") - } - supplierIndexMap[index] = struct{}{} - } - - // Check that the stake value for the suppliers is valid - for _, supplier := range gs.SupplierList { - // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, - // similar to how we have `ValidateAppServiceConfigs` below - if supplier.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") - } - stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) - } - - // Validate the application service configs - if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) - } - } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.Validate() diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index 5895fd717..ee12da6e2 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -3,46 +3,11 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" "github.com/stretchr/testify/require" ) func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - serviceConfig1 := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - } - serviceList1 := []*sharedtypes.SupplierServiceConfig{serviceConfig1} - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - serviceConfig2 := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - } - serviceList2 := []*sharedtypes.SupplierServiceConfig{serviceConfig2} - tests := []struct { desc string genState *types.GenesisState @@ -54,249 +19,13 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "valid genesis state", + desc: "valid genesis state", genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: serviceList2, - }, - }, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, }, - { - desc: "invalid - zero supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to duplicated supplier address", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr1, - Stake: &stake2, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to nil supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: nil, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to missing supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - // Explicitly missing stake - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing services list", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - // Services: intentionally omitted - }, - }, - }, - valid: false, - }, - { - desc: "invalid - empty services list", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - invalid URL", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "invalid URL", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - invalid RPC Type", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_UNKNOWN_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - }, - valid: false, - }, // this line is used by starport scaffolding # types/genesis/testcase } for _, tc := range tests { diff --git a/x/supplier/types/keys.go b/x/supplier/types/keys.go index 138fd0f19..fe2ebecc7 100644 --- a/x/supplier/types/keys.go +++ b/x/supplier/types/keys.go @@ -1,9 +1,5 @@ package types -import ( - "bytes" -) - const ( // ModuleName defines the module name ModuleName = "supplier" @@ -11,22 +7,14 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName - // RouterKey defines the module's message routing key - RouterKey = ModuleName - // MemStoreKey defines the in-memory store key MemStoreKey = "mem_supplier" ) -// KeyDelimiter is the delimiter for composite keys. -var KeyDelimiter = []byte("/") - -// KeyPrefix returns the given prefix as a byte slice for use with the KVStore. -func KeyPrefix(prefix string) []byte { - return []byte(prefix) -} +var ( + ParamsKey = []byte("p_supplier") +) -// KeyComposite combines the given keys into a single key for use with KVStore. -func KeyComposite(keys ...[]byte) []byte { - return bytes.Join(keys, KeyDelimiter) +func KeyPrefix(p string) []byte { + return []byte(p) } diff --git a/x/supplier/types/msg_update_params.go b/x/supplier/types/msg_update_params.go new file mode 100644 index 000000000..e36d023de --- /dev/null +++ b/x/supplier/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/supplier/types/params.go b/x/supplier/types/params.go index 357196ad6..4f3215e35 100644 --- a/x/supplier/types/params.go +++ b/x/supplier/types/params.go @@ -2,7 +2,6 @@ package types import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" ) var _ paramtypes.ParamSet = (*Params)(nil) @@ -31,9 +30,3 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { func (p Params) Validate() error { return nil } - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} From 432042b99b365cbadb71d8655467b503532b582d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 12:39:56 +0100 Subject: [PATCH 02/23] scaffold: map supplier --module supplier --no-message address stake:coin services --- api/poktroll/supplier/genesis.pulsar.go | 207 +- api/poktroll/supplier/query.pulsar.go | 2209 +++++++++++++++++++++- api/poktroll/supplier/supplier.pulsar.go | 812 ++++++++ proto/poktroll/supplier/genesis.proto | 10 +- proto/poktroll/supplier/query.proto | 44 +- proto/poktroll/supplier/supplier.proto | 15 + x/supplier/keeper/query_supplier.go | 28 +- x/supplier/keeper/query_supplier_test.go | 25 +- x/supplier/keeper/supplier.go | 58 +- x/supplier/keeper/supplier_test.go | 83 +- x/supplier/module/autocli.go | 11 + x/supplier/module/debug_container.dot | 502 +++++ x/supplier/module/debug_container.log | 379 ++++ x/supplier/module/genesis.go | 5 + x/supplier/module/genesis_test.go | 9 + x/supplier/types/genesis.go | 13 +- x/supplier/types/genesis_test.go | 24 +- x/supplier/types/key_supplier.go | 6 +- 18 files changed, 4241 insertions(+), 199 deletions(-) create mode 100644 api/poktroll/supplier/supplier.pulsar.go create mode 100644 proto/poktroll/supplier/supplier.proto create mode 100644 x/supplier/module/debug_container.dot create mode 100644 x/supplier/module/debug_container.log diff --git a/api/poktroll/supplier/genesis.pulsar.go b/api/poktroll/supplier/genesis.pulsar.go index dc9fea872..9e9b76ad8 100644 --- a/api/poktroll/supplier/genesis.pulsar.go +++ b/api/poktroll/supplier/genesis.pulsar.go @@ -14,15 +14,68 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*Supplier +} + +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().(*Supplier) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Supplier) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(Supplier) + *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(Supplier) + 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_supplierList protoreflect.FieldDescriptor ) func init() { file_poktroll_supplier_genesis_proto_init() md_GenesisState = File_poktroll_supplier_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_supplierList = md_GenesisState.Fields().ByName("supplierList") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -96,6 +149,12 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } + if len(x.SupplierList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.SupplierList}) + if !f(fd_GenesisState_supplierList, 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.supplier.GenesisState.params": return x.Params != nil + case "poktroll.supplier.GenesisState.supplierList": + return len(x.SupplierList) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) @@ -131,6 +192,8 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.supplier.GenesisState.params": x.Params = nil + case "poktroll.supplier.GenesisState.supplierList": + x.SupplierList = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) @@ -150,6 +213,12 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "poktroll.supplier.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.supplier.GenesisState.supplierList": + if len(x.SupplierList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.SupplierList} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) @@ -172,6 +241,10 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "poktroll.supplier.GenesisState.params": x.Params = value.Message().Interface().(*Params) + case "poktroll.supplier.GenesisState.supplierList": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.SupplierList = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.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.supplier.GenesisState.supplierList": + if x.SupplierList == nil { + x.SupplierList = []*Supplier{} + } + value := &_GenesisState_2_list{list: &x.SupplierList} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) @@ -213,6 +292,9 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.supplier.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.supplier.GenesisState.supplierList": + list := []*Supplier{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.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.SupplierList) > 0 { + for _, e := range x.SupplierList { + 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.SupplierList) > 0 { + for iNdEx := len(x.SupplierList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.SupplierList[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 SupplierList", 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.SupplierList = append(x.SupplierList, &Supplier{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SupplierList[len(x.SupplierList)-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"` + SupplierList []*Supplier `protobuf:"bytes,2,rep,name=supplierList,proto3" json:"supplierList,omitempty"` } func (x *GenesisState) Reset() { @@ -499,6 +638,13 @@ func (x *GenesisState) GetParams() *Params { return nil } +func (x *GenesisState) GetSupplierList() []*Supplier { + if x != nil { + return x.SupplierList + } + return nil +} + var File_poktroll_supplier_genesis_proto protoreflect.FileDescriptor var file_poktroll_supplier_genesis_proto_rawDesc = []byte{ @@ -509,24 +655,30 @@ var file_poktroll_supplier_genesis_proto_rawDesc = []byte{ 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, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4c, 0x0a, - 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, - 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x15, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, - 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x93, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, + 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, + 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xae, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, + 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -545,14 +697,16 @@ var file_poktroll_supplier_genesis_proto_msgTypes = make([]protoimpl.MessageInfo var file_poktroll_supplier_genesis_proto_goTypes = []interface{}{ (*GenesisState)(nil), // 0: poktroll.supplier.GenesisState (*Params)(nil), // 1: poktroll.supplier.Params + (*Supplier)(nil), // 2: poktroll.supplier.Supplier } var file_poktroll_supplier_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.supplier.GenesisState.params:type_name -> poktroll.supplier.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.supplier.GenesisState.supplierList:type_name -> poktroll.supplier.Supplier + 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_supplier_genesis_proto_init() } @@ -561,6 +715,7 @@ func file_poktroll_supplier_genesis_proto_init() { return } file_poktroll_supplier_params_proto_init() + file_poktroll_supplier_supplier_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_supplier_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenesisState); i { diff --git a/api/poktroll/supplier/query.pulsar.go b/api/poktroll/supplier/query.pulsar.go index 16b94d210..2245a83bd 100644 --- a/api/poktroll/supplier/query.pulsar.go +++ b/api/poktroll/supplier/query.pulsar.go @@ -3,7 +3,8 @@ package supplier 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_QueryGetSupplierRequest protoreflect.MessageDescriptor + fd_QueryGetSupplierRequest_index protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryGetSupplierRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryGetSupplierRequest") + fd_QueryGetSupplierRequest_index = md_QueryGetSupplierRequest.Fields().ByName("index") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetSupplierRequest)(nil) + +type fastReflection_QueryGetSupplierRequest QueryGetSupplierRequest + +func (x *QueryGetSupplierRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetSupplierRequest)(x) +} + +func (x *QueryGetSupplierRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_QueryGetSupplierRequest_messageType fastReflection_QueryGetSupplierRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetSupplierRequest_messageType{} + +type fastReflection_QueryGetSupplierRequest_messageType struct{} + +func (x fastReflection_QueryGetSupplierRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetSupplierRequest)(nil) +} +func (x fastReflection_QueryGetSupplierRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierRequest) +} +func (x fastReflection_QueryGetSupplierRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetSupplierRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierRequest +} + +// 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_QueryGetSupplierRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetSupplierRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetSupplierRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetSupplierRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetSupplierRequest)(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_QueryGetSupplierRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Index != "" { + value := protoreflect.ValueOfString(x.Index) + if !f(fd_QueryGetSupplierRequest_index, 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_QueryGetSupplierRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.index": + return x.Index != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest 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_QueryGetSupplierRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.index": + x.Index = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest 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_QueryGetSupplierRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.index": + value := x.Index + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest 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_QueryGetSupplierRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.index": + x.Index = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest 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_QueryGetSupplierRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.index": + panic(fmt.Errorf("field index of message poktroll.supplier.QueryGetSupplierRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest 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_QueryGetSupplierRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.index": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest 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_QueryGetSupplierRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryGetSupplierRequest", 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_QueryGetSupplierRequest) 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_QueryGetSupplierRequest) 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_QueryGetSupplierRequest) 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_QueryGetSupplierRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetSupplierRequest) + 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.Index) + 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().(*QueryGetSupplierRequest) + 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.Index) > 0 { + i -= len(x.Index) + copy(dAtA[i:], x.Index) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + 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().(*QueryGetSupplierRequest) + 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: QueryGetSupplierRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSupplierRequest: 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 Index", 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.Index = 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_QueryGetSupplierResponse protoreflect.MessageDescriptor + fd_QueryGetSupplierResponse_supplier protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryGetSupplierResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryGetSupplierResponse") + fd_QueryGetSupplierResponse_supplier = md_QueryGetSupplierResponse.Fields().ByName("supplier") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetSupplierResponse)(nil) + +type fastReflection_QueryGetSupplierResponse QueryGetSupplierResponse + +func (x *QueryGetSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetSupplierResponse)(x) +} + +func (x *QueryGetSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_QueryGetSupplierResponse_messageType fastReflection_QueryGetSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetSupplierResponse_messageType{} + +type fastReflection_QueryGetSupplierResponse_messageType struct{} + +func (x fastReflection_QueryGetSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetSupplierResponse)(nil) +} +func (x fastReflection_QueryGetSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierResponse) +} +func (x fastReflection_QueryGetSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierResponse +} + +// 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_QueryGetSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetSupplierResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetSupplierResponse)(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_QueryGetSupplierResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Supplier != nil { + value := protoreflect.ValueOfMessage(x.Supplier.ProtoReflect()) + if !f(fd_QueryGetSupplierResponse_supplier, 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_QueryGetSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + return x.Supplier != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse 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_QueryGetSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + x.Supplier = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse 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_QueryGetSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + value := x.Supplier + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse 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_QueryGetSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + x.Supplier = value.Message().Interface().(*Supplier) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse 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_QueryGetSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + if x.Supplier == nil { + x.Supplier = new(Supplier) + } + return protoreflect.ValueOfMessage(x.Supplier.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse 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_QueryGetSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + m := new(Supplier) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse 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_QueryGetSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryGetSupplierResponse", 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_QueryGetSupplierResponse) 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_QueryGetSupplierResponse) 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_QueryGetSupplierResponse) 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_QueryGetSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetSupplierResponse) + 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.Supplier != nil { + l = options.Size(x.Supplier) + 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().(*QueryGetSupplierResponse) + 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.Supplier != nil { + encoded, err := options.Marshal(x.Supplier) + 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().(*QueryGetSupplierResponse) + 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: QueryGetSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSupplierResponse: 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 Supplier", 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.Supplier == nil { + x.Supplier = &Supplier{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Supplier); 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_QueryAllSupplierRequest protoreflect.MessageDescriptor + fd_QueryAllSupplierRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryAllSupplierRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSupplierRequest") + fd_QueryAllSupplierRequest_pagination = md_QueryAllSupplierRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllSupplierRequest)(nil) + +type fastReflection_QueryAllSupplierRequest QueryAllSupplierRequest + +func (x *QueryAllSupplierRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllSupplierRequest)(x) +} + +func (x *QueryAllSupplierRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_QueryAllSupplierRequest_messageType fastReflection_QueryAllSupplierRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllSupplierRequest_messageType{} + +type fastReflection_QueryAllSupplierRequest_messageType struct{} + +func (x fastReflection_QueryAllSupplierRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllSupplierRequest)(nil) +} +func (x fastReflection_QueryAllSupplierRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllSupplierRequest) +} +func (x fastReflection_QueryAllSupplierRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSupplierRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllSupplierRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSupplierRequest +} + +// 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_QueryAllSupplierRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllSupplierRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllSupplierRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllSupplierRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllSupplierRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllSupplierRequest)(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_QueryAllSupplierRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllSupplierRequest_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_QueryAllSupplierRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest 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_QueryAllSupplierRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest 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_QueryAllSupplierRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryAllSupplierRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest 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_QueryAllSupplierRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest 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_QueryAllSupplierRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierRequest.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.supplier.QueryAllSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest 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_QueryAllSupplierRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierRequest.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.supplier.QueryAllSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest 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_QueryAllSupplierRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSupplierRequest", 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_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllSupplierRequest) + 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().(*QueryAllSupplierRequest) + 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().(*QueryAllSupplierRequest) + 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: QueryAllSupplierRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSupplierRequest: 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 = (*_QueryAllSupplierResponse_1_list)(nil) + +type _QueryAllSupplierResponse_1_list struct { + list *[]*Supplier +} + +func (x *_QueryAllSupplierResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllSupplierResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllSupplierResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Supplier) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllSupplierResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Supplier) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllSupplierResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Supplier) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllSupplierResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllSupplierResponse_1_list) NewElement() protoreflect.Value { + v := new(Supplier) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllSupplierResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllSupplierResponse protoreflect.MessageDescriptor + fd_QueryAllSupplierResponse_supplier protoreflect.FieldDescriptor + fd_QueryAllSupplierResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryAllSupplierResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSupplierResponse") + fd_QueryAllSupplierResponse_supplier = md_QueryAllSupplierResponse.Fields().ByName("supplier") + fd_QueryAllSupplierResponse_pagination = md_QueryAllSupplierResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllSupplierResponse)(nil) + +type fastReflection_QueryAllSupplierResponse QueryAllSupplierResponse + +func (x *QueryAllSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllSupplierResponse)(x) +} + +func (x *QueryAllSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_QueryAllSupplierResponse_messageType fastReflection_QueryAllSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllSupplierResponse_messageType{} + +type fastReflection_QueryAllSupplierResponse_messageType struct{} + +func (x fastReflection_QueryAllSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllSupplierResponse)(nil) +} +func (x fastReflection_QueryAllSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllSupplierResponse) +} +func (x fastReflection_QueryAllSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSupplierResponse +} + +// 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_QueryAllSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllSupplierResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllSupplierResponse)(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_QueryAllSupplierResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Supplier) != 0 { + value := protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{list: &x.Supplier}) + if !f(fd_QueryAllSupplierResponse_supplier, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllSupplierResponse_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_QueryAllSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierResponse.supplier": + return len(x.Supplier) != 0 + case "poktroll.supplier.QueryAllSupplierResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse 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_QueryAllSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierResponse.supplier": + x.Supplier = nil + case "poktroll.supplier.QueryAllSupplierResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse 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_QueryAllSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryAllSupplierResponse.supplier": + if len(x.Supplier) == 0 { + return protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{}) + } + listValue := &_QueryAllSupplierResponse_1_list{list: &x.Supplier} + return protoreflect.ValueOfList(listValue) + case "poktroll.supplier.QueryAllSupplierResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse 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_QueryAllSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierResponse.supplier": + lv := value.List() + clv := lv.(*_QueryAllSupplierResponse_1_list) + x.Supplier = *clv.list + case "poktroll.supplier.QueryAllSupplierResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse 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_QueryAllSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierResponse.supplier": + if x.Supplier == nil { + x.Supplier = []*Supplier{} + } + value := &_QueryAllSupplierResponse_1_list{list: &x.Supplier} + return protoreflect.ValueOfList(value) + case "poktroll.supplier.QueryAllSupplierResponse.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.supplier.QueryAllSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse 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_QueryAllSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSupplierResponse.supplier": + list := []*Supplier{} + return protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{list: &list}) + case "poktroll.supplier.QueryAllSupplierResponse.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.supplier.QueryAllSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse 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_QueryAllSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSupplierResponse", 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_QueryAllSupplierResponse) 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_QueryAllSupplierResponse) 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_QueryAllSupplierResponse) 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_QueryAllSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllSupplierResponse) + 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.Supplier) > 0 { + for _, e := range x.Supplier { + 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().(*QueryAllSupplierResponse) + 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.Supplier) > 0 { + for iNdEx := len(x.Supplier) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Supplier[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().(*QueryAllSupplierResponse) + 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: QueryAllSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSupplierResponse: 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 Supplier", 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.Supplier = append(x.Supplier, &Supplier{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Supplier[len(x.Supplier)-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 QueryGetSupplierRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` +} + +func (x *QueryGetSupplierRequest) Reset() { + *x = QueryGetSupplierRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetSupplierRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetSupplierRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetSupplierRequest.ProtoReflect.Descriptor instead. +func (*QueryGetSupplierRequest) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetSupplierRequest) GetIndex() string { + if x != nil { + return x.Index + } + return "" +} + +type QueryGetSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Supplier *Supplier `protobuf:"bytes,1,opt,name=supplier,proto3" json:"supplier,omitempty"` +} + +func (x *QueryGetSupplierResponse) Reset() { + *x = QueryGetSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetSupplierResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetSupplierResponse.ProtoReflect.Descriptor instead. +func (*QueryGetSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetSupplierResponse) GetSupplier() *Supplier { + if x != nil { + return x.Supplier + } + return nil +} + +type QueryAllSupplierRequest 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 *QueryAllSupplierRequest) Reset() { + *x = QueryAllSupplierRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllSupplierRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllSupplierRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllSupplierRequest.ProtoReflect.Descriptor instead. +func (*QueryAllSupplierRequest) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllSupplierRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Supplier []*Supplier `protobuf:"bytes,1,rep,name=supplier,proto3" json:"supplier,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllSupplierResponse) Reset() { + *x = QueryAllSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllSupplierResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllSupplierResponse.ProtoReflect.Descriptor instead. +func (*QueryAllSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllSupplierResponse) GetSupplier() []*Supplier { + if x != nil { + return x.Supplier + } + return nil +} + +func (x *QueryAllSupplierResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + var File_poktroll_supplier_query_proto protoreflect.FileDescriptor var file_poktroll_supplier_query_proto_rawDesc = []byte{ @@ -899,34 +2911,83 @@ var file_poktroll_supplier_query_proto_rawDesc = []byte{ 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x0a, 0x13, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, - 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x32, 0x91, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x42, 0xac, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0a, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, - 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 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, 0x53, 0x0a, + 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x22, 0x2f, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x22, 0x59, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3d, 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x22, 0x61, + 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 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, 0xa2, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, + 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xcc, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x08, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0b, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x6c, 0x6c, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0xac, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, + 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, + 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -941,21 +3002,36 @@ func file_poktroll_supplier_query_proto_rawDescGZIP() []byte { return file_poktroll_supplier_query_proto_rawDescData } -var file_poktroll_supplier_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_supplier_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_supplier_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.supplier.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.supplier.QueryParamsResponse - (*Params)(nil), // 2: poktroll.supplier.Params + (*QueryParamsRequest)(nil), // 0: poktroll.supplier.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.supplier.QueryParamsResponse + (*QueryGetSupplierRequest)(nil), // 2: poktroll.supplier.QueryGetSupplierRequest + (*QueryGetSupplierResponse)(nil), // 3: poktroll.supplier.QueryGetSupplierResponse + (*QueryAllSupplierRequest)(nil), // 4: poktroll.supplier.QueryAllSupplierRequest + (*QueryAllSupplierResponse)(nil), // 5: poktroll.supplier.QueryAllSupplierResponse + (*Params)(nil), // 6: poktroll.supplier.Params + (*Supplier)(nil), // 7: poktroll.supplier.Supplier + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_supplier_query_proto_depIdxs = []int32{ - 2, // 0: poktroll.supplier.QueryParamsResponse.params:type_name -> poktroll.supplier.Params - 0, // 1: poktroll.supplier.Query.Params:input_type -> poktroll.supplier.QueryParamsRequest - 1, // 2: poktroll.supplier.Query.Params:output_type -> poktroll.supplier.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.supplier.QueryParamsResponse.params:type_name -> poktroll.supplier.Params + 7, // 1: poktroll.supplier.QueryGetSupplierResponse.supplier:type_name -> poktroll.supplier.Supplier + 8, // 2: poktroll.supplier.QueryAllSupplierRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.supplier.QueryAllSupplierResponse.supplier:type_name -> poktroll.supplier.Supplier + 9, // 4: poktroll.supplier.QueryAllSupplierResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.supplier.Query.Params:input_type -> poktroll.supplier.QueryParamsRequest + 2, // 6: poktroll.supplier.Query.Supplier:input_type -> poktroll.supplier.QueryGetSupplierRequest + 4, // 7: poktroll.supplier.Query.SupplierAll:input_type -> poktroll.supplier.QueryAllSupplierRequest + 1, // 8: poktroll.supplier.Query.Params:output_type -> poktroll.supplier.QueryParamsResponse + 3, // 9: poktroll.supplier.Query.Supplier:output_type -> poktroll.supplier.QueryGetSupplierResponse + 5, // 10: poktroll.supplier.Query.SupplierAll:output_type -> poktroll.supplier.QueryAllSupplierResponse + 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_supplier_query_proto_init() } @@ -964,6 +3040,7 @@ func file_poktroll_supplier_query_proto_init() { return } file_poktroll_supplier_params_proto_init() + file_poktroll_supplier_supplier_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_supplier_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { @@ -989,6 +3066,54 @@ func file_poktroll_supplier_query_proto_init() { return nil } } + file_poktroll_supplier_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetSupplierRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetSupplierResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllSupplierRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllSupplierResponse); 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{ @@ -996,7 +3121,7 @@ func file_poktroll_supplier_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_supplier_query_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/supplier/supplier.pulsar.go b/api/poktroll/supplier/supplier.pulsar.go new file mode 100644 index 000000000..ae580c72d --- /dev/null +++ b/api/poktroll/supplier/supplier.pulsar.go @@ -0,0 +1,812 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +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_Supplier protoreflect.MessageDescriptor + fd_Supplier_index protoreflect.FieldDescriptor + fd_Supplier_address protoreflect.FieldDescriptor + fd_Supplier_stake protoreflect.FieldDescriptor + fd_Supplier_services protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_supplier_proto_init() + md_Supplier = File_poktroll_supplier_supplier_proto.Messages().ByName("Supplier") + fd_Supplier_index = md_Supplier.Fields().ByName("index") + fd_Supplier_address = md_Supplier.Fields().ByName("address") + fd_Supplier_stake = md_Supplier.Fields().ByName("stake") + fd_Supplier_services = md_Supplier.Fields().ByName("services") +} + +var _ protoreflect.Message = (*fastReflection_Supplier)(nil) + +type fastReflection_Supplier Supplier + +func (x *Supplier) ProtoReflect() protoreflect.Message { + return (*fastReflection_Supplier)(x) +} + +func (x *Supplier) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_supplier_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_Supplier_messageType fastReflection_Supplier_messageType +var _ protoreflect.MessageType = fastReflection_Supplier_messageType{} + +type fastReflection_Supplier_messageType struct{} + +func (x fastReflection_Supplier_messageType) Zero() protoreflect.Message { + return (*fastReflection_Supplier)(nil) +} +func (x fastReflection_Supplier_messageType) New() protoreflect.Message { + return new(fastReflection_Supplier) +} +func (x fastReflection_Supplier_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Supplier +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Supplier) Descriptor() protoreflect.MessageDescriptor { + return md_Supplier +} + +// 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_Supplier) Type() protoreflect.MessageType { + return _fastReflection_Supplier_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Supplier) New() protoreflect.Message { + return new(fastReflection_Supplier) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Supplier) Interface() protoreflect.ProtoMessage { + return (*Supplier)(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_Supplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Index != "" { + value := protoreflect.ValueOfString(x.Index) + if !f(fd_Supplier_index, value) { + return + } + } + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_Supplier_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_Supplier_stake, value) { + return + } + } + if x.Services != "" { + value := protoreflect.ValueOfString(x.Services) + if !f(fd_Supplier_services, 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_Supplier) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.Supplier.index": + return x.Index != "" + case "poktroll.supplier.Supplier.address": + return x.Address != "" + case "poktroll.supplier.Supplier.stake": + return x.Stake != nil + case "poktroll.supplier.Supplier.services": + return x.Services != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + } + panic(fmt.Errorf("message poktroll.supplier.Supplier 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_Supplier) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.Supplier.index": + x.Index = "" + case "poktroll.supplier.Supplier.address": + x.Address = "" + case "poktroll.supplier.Supplier.stake": + x.Stake = nil + case "poktroll.supplier.Supplier.services": + x.Services = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + } + panic(fmt.Errorf("message poktroll.supplier.Supplier 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_Supplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.Supplier.index": + value := x.Index + return protoreflect.ValueOfString(value) + case "poktroll.supplier.Supplier.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.supplier.Supplier.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.supplier.Supplier.services": + value := x.Services + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + } + panic(fmt.Errorf("message poktroll.supplier.Supplier 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_Supplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.Supplier.index": + x.Index = value.Interface().(string) + case "poktroll.supplier.Supplier.address": + x.Address = value.Interface().(string) + case "poktroll.supplier.Supplier.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.supplier.Supplier.services": + x.Services = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + } + panic(fmt.Errorf("message poktroll.supplier.Supplier 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_Supplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.Supplier.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.supplier.Supplier.index": + panic(fmt.Errorf("field index of message poktroll.supplier.Supplier is not mutable")) + case "poktroll.supplier.Supplier.address": + panic(fmt.Errorf("field address of message poktroll.supplier.Supplier is not mutable")) + case "poktroll.supplier.Supplier.services": + panic(fmt.Errorf("field services of message poktroll.supplier.Supplier is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + } + panic(fmt.Errorf("message poktroll.supplier.Supplier 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_Supplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.Supplier.index": + return protoreflect.ValueOfString("") + case "poktroll.supplier.Supplier.address": + return protoreflect.ValueOfString("") + case "poktroll.supplier.Supplier.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.supplier.Supplier.services": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + } + panic(fmt.Errorf("message poktroll.supplier.Supplier 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_Supplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.Supplier", 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_Supplier) 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_Supplier) 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_Supplier) 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_Supplier) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Supplier) + 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.Index) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(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)) + } + l = len(x.Services) + 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().(*Supplier) + 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.Services) > 0 { + i -= len(x.Services) + copy(dAtA[i:], x.Services) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Services))) + i-- + dAtA[i] = 0x22 + } + 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] = 0x1a + } + 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] = 0x12 + } + if len(x.Index) > 0 { + i -= len(x.Index) + copy(dAtA[i:], x.Index) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + 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().(*Supplier) + 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: Supplier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Supplier: 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 Index", 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.Index = 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 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 3: + 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 + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", 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.Services = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/supplier.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 Supplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Stake *v1beta1.Coin `protobuf:"bytes,3,opt,name=stake,proto3" json:"stake,omitempty"` + Services string `protobuf:"bytes,4,opt,name=services,proto3" json:"services,omitempty"` +} + +func (x *Supplier) Reset() { + *x = Supplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_supplier_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Supplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Supplier) ProtoMessage() {} + +// Deprecated: Use Supplier.ProtoReflect.Descriptor instead. +func (*Supplier) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_supplier_proto_rawDescGZIP(), []int{0} +} + +func (x *Supplier) GetIndex() string { + if x != nil { + return x.Index + } + return "" +} + +func (x *Supplier) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Supplier) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *Supplier) GetServices() string { + if x != nil { + return x.Services + } + return "" +} + +var File_poktroll_supplier_supplier_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_supplier_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x8d, 0x01, 0x0a, 0x08, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xaf, 0x01, 0x0a, 0x15, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, + 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_supplier_proto_rawDescOnce sync.Once + file_poktroll_supplier_supplier_proto_rawDescData = file_poktroll_supplier_supplier_proto_rawDesc +) + +func file_poktroll_supplier_supplier_proto_rawDescGZIP() []byte { + file_poktroll_supplier_supplier_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_supplier_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_supplier_proto_rawDescData) + }) + return file_poktroll_supplier_supplier_proto_rawDescData +} + +var file_poktroll_supplier_supplier_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_supplier_proto_goTypes = []interface{}{ + (*Supplier)(nil), // 0: poktroll.supplier.Supplier + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin +} +var file_poktroll_supplier_supplier_proto_depIdxs = []int32{ + 1, // 0: poktroll.supplier.Supplier.stake:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_supplier_proto_init() } +func file_poktroll_supplier_supplier_proto_init() { + if File_poktroll_supplier_supplier_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_supplier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Supplier); 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_supplier_supplier_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_supplier_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_supplier_proto_depIdxs, + MessageInfos: file_poktroll_supplier_supplier_proto_msgTypes, + }.Build() + File_poktroll_supplier_supplier_proto = out.File + file_poktroll_supplier_supplier_proto_rawDesc = nil + file_poktroll_supplier_supplier_proto_goTypes = nil + file_poktroll_supplier_supplier_proto_depIdxs = nil +} diff --git a/proto/poktroll/supplier/genesis.proto b/proto/poktroll/supplier/genesis.proto index 271750d68..1ae2bd210 100644 --- a/proto/poktroll/supplier/genesis.proto +++ b/proto/poktroll/supplier/genesis.proto @@ -1,17 +1,19 @@ syntax = "proto3"; + package poktroll.supplier; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "poktroll/supplier/params.proto"; +import "poktroll/supplier/supplier.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; // GenesisState defines the supplier 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 Supplier supplierList = 2 [(gogoproto.nullable) = false] ; } + diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto index a9f01c722..a43fd9a68 100644 --- a/proto/poktroll/supplier/query.proto +++ b/proto/poktroll/supplier/query.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.supplier; 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/supplier/params.proto"; +import "poktroll/supplier/supplier.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/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/supplier/params"; + + } + + // Queries a list of Supplier items. + rpc Supplier (QueryGetSupplierRequest) returns (QueryGetSupplierResponse) { + option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier/{index}"; + + } + rpc SupplierAll (QueryAllSupplierRequest) returns (QueryAllSupplierResponse) { + option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier"; + } } - // 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 QueryGetSupplierRequest { + string index = 1; +} + +message QueryGetSupplierResponse { + Supplier supplier = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllSupplierRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllSupplierResponse { + repeated Supplier supplier = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/supplier/supplier.proto b/proto/poktroll/supplier/supplier.proto new file mode 100644 index 000000000..f4bdf8226 --- /dev/null +++ b/proto/poktroll/supplier/supplier.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package poktroll.supplier; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +message Supplier { + string index = 1; + string address = 2; + cosmos.base.v1beta1.Coin stake = 3 [(gogoproto.nullable) = false]; + string services = 4; + +} + diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go index c27e8e8f6..598b719f5 100644 --- a/x/supplier/keeper/query_supplier.go +++ b/x/supplier/keeper/query_supplier.go @@ -2,31 +2,27 @@ package keeper import ( "context" - "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/pokt-network/poktroll/x/supplier/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { +func (k Keeper) SupplierAll(ctx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - var suppliers []sharedtypes.Supplier - ctx := sdk.UnwrapSDKContext(goCtx) + var suppliers []types.Supplier - store := ctx.KVStore(k.storeKey) + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { - var supplier sharedtypes.Supplier + var supplier types.Supplier if err := k.cdc.Unmarshal(value, &supplier); err != nil { return err } @@ -34,6 +30,7 @@ func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRe suppliers = append(suppliers, supplier) return nil }) + if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -41,20 +38,17 @@ func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRe return &types.QueryAllSupplierResponse{Supplier: suppliers, Pagination: pageRes}, nil } -func (k Keeper) Supplier(goCtx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { +func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) val, found := k.GetSupplier( ctx, - req.Address, + req.Index, ) if !found { - // TODO_TECHDEBT(#181): conform to logging conventions once established - msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) - return nil, status.Error(codes.NotFound, msg) + return nil, status.Error(codes.NotFound, "not found") } return &types.QueryGetSupplierResponse{Supplier: val}, nil diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go index bfd4f8019..7d950dc42 100644 --- a/x/supplier/keeper/query_supplier_test.go +++ b/x/supplier/keeper/query_supplier_test.go @@ -4,7 +4,6 @@ import ( "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -19,8 +18,7 @@ import ( var _ = strconv.IntSize func TestSupplierQuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) + keeper, ctx := keepertest.SupplierKeeper(t) msgs := createNSupplier(keeper, ctx, 2) tests := []struct { desc string @@ -31,23 +29,23 @@ func TestSupplierQuerySingle(t *testing.T) { { desc: "First", request: &types.QueryGetSupplierRequest{ - Address: msgs[0].Address, + Index: msgs[0].Index, }, response: &types.QueryGetSupplierResponse{Supplier: msgs[0]}, }, { desc: "Second", request: &types.QueryGetSupplierRequest{ - Address: msgs[1].Address, + Index: msgs[1].Index, }, response: &types.QueryGetSupplierResponse{Supplier: msgs[1]}, }, { desc: "KeyNotFound", request: &types.QueryGetSupplierRequest{ - Address: strconv.Itoa(100000), + Index: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "supplier with address \"100000\""), + err: status.Error(codes.NotFound, "not found"), }, { desc: "InvalidRequest", @@ -56,7 +54,7 @@ func TestSupplierQuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Supplier(wctx, tc.request) + response, err := keeper.Supplier(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -71,8 +69,7 @@ func TestSupplierQuerySingle(t *testing.T) { } func TestSupplierQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) + keeper, ctx := keepertest.SupplierKeeper(t) msgs := createNSupplier(keeper, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSupplierRequest { @@ -88,7 +85,7 @@ func TestSupplierQueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(wctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.SupplierAll(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.Supplier), step) require.Subset(t, @@ -101,7 +98,7 @@ func TestSupplierQueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(wctx, request(next, 0, uint64(step), false)) + resp, err := keeper.SupplierAll(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.Supplier), step) require.Subset(t, @@ -112,7 +109,7 @@ func TestSupplierQueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.SupplierAll(wctx, request(nil, 0, 0, true)) + resp, err := keeper.SupplierAll(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -121,7 +118,7 @@ func TestSupplierQueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.SupplierAll(wctx, nil) + _, err := keeper.SupplierAll(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go index c5edeefc4..dc661e8bb 100644 --- a/x/supplier/keeper/supplier.go +++ b/x/supplier/keeper/supplier.go @@ -1,66 +1,70 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" + "context" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/pokt-network/poktroll/x/supplier/types" ) // SetSupplier set a specific supplier in the store from its index -func (k Keeper) SetSupplier(ctx sdk.Context, supplier sharedtypes.Supplier) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) +func (k Keeper) SetSupplier(ctx context.Context, supplier types.Supplier) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) b := k.cdc.MustMarshal(&supplier) store.Set(types.SupplierKey( - supplier.Address, + supplier.Index, ), b) } // GetSupplier returns a supplier from its index func (k Keeper) GetSupplier( - ctx sdk.Context, - supplierAddr string, -) (supplier sharedtypes.Supplier, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) + ctx context.Context, + index string, + +) (val types.Supplier, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) b := store.Get(types.SupplierKey( - supplierAddr, + index, )) if b == nil { - return supplier, false + return val, false } - k.cdc.MustUnmarshal(b, &supplier) - return supplier, true + k.cdc.MustUnmarshal(b, &val) + return val, true } // RemoveSupplier removes a supplier from the store func (k Keeper) RemoveSupplier( - ctx sdk.Context, - supplierAddr string, + ctx context.Context, + index string, + ) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) store.Delete(types.SupplierKey( - supplierAddr, + index, )) } // GetAllSupplier returns all supplier -func (k Keeper) GetAllSupplier(ctx sdk.Context) (suppliers []sharedtypes.Supplier) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +func (k Keeper) GetAllSupplier(ctx context.Context) (list []types.Supplier) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var supplier sharedtypes.Supplier - k.cdc.MustUnmarshal(iterator.Value(), &supplier) - suppliers = append(suppliers, supplier) + var val types.Supplier + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) } return } - -// TODO_OPTIMIZE: Index suppliers by service so we can easily query `k.GetAllSupplier(ctx, Service)` -// func (k Keeper) GetAllSupplier(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go index 03b1e470a..993c3b74b 100644 --- a/x/supplier/keeper/supplier_test.go +++ b/x/supplier/keeper/supplier_test.go @@ -1,94 +1,63 @@ package keeper_test import ( - "fmt" + "context" "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" + "github.com/stretchr/testify/require" ) // Prevent strconv unused error var _ = strconv.IntSize -func init() { - cmd.InitSDKConfig() -} +func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []types.Supplier { + items := make([]types.Supplier, n) + for i := range items { + items[i].Index = strconv.Itoa(i) -func createNSupplier(keeper *keeper.Keeper, ctx sdk.Context, n int) []sharedtypes.Supplier { - suppliers := make([]sharedtypes.Supplier, n) - for i := range suppliers { - supplier := &suppliers[i] - supplier.Address = sample.AccAddress() - supplier.Stake = &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(int64(i))} - supplier.Services = []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: fmt.Sprintf("http://localhost:%d", i), - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - } - keeper.SetSupplier(ctx, *supplier) + keeper.SetSupplier(ctx, items[i]) } - - return suppliers + return items } func TestSupplierGet(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - for _, supplier := range suppliers { - supplierFound, isSupplierFound := keeper.GetSupplier(ctx, - supplier.Address, + keeper, ctx := keepertest.SupplierKeeper(t) + items := createNSupplier(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetSupplier(ctx, + item.Index, ) - require.True(t, isSupplierFound) + require.True(t, found) require.Equal(t, - nullify.Fill(&supplier), - nullify.Fill(&supplierFound), + nullify.Fill(&item), + nullify.Fill(&rst), ) } } func TestSupplierRemove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - for _, supplier := range suppliers { + keeper, ctx := keepertest.SupplierKeeper(t) + items := createNSupplier(keeper, ctx, 10) + for _, item := range items { keeper.RemoveSupplier(ctx, - supplier.Address, + item.Index, ) - _, isSupplierFound := keeper.GetSupplier(ctx, - supplier.Address, + _, found := keeper.GetSupplier(ctx, + item.Index, ) - require.False(t, isSupplierFound) + require.False(t, found) } } func TestSupplierGetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) + keeper, ctx := keepertest.SupplierKeeper(t) + items := createNSupplier(keeper, ctx, 10) require.ElementsMatch(t, - nullify.Fill(suppliers), + nullify.Fill(items), nullify.Fill(keeper.GetAllSupplier(ctx)), ) } - -// The application module address is derived off of its semantic name. -// This test is a helper for us to easily identify the underlying address. -func TestApplicationModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1j40dzzmn6cn9kxku7a5tjnud6hv37vesr5ccaa", moduleAddress.String()) -} diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index 737ce98ea..2325ea034 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -17,6 +17,17 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Use: "params", Short: "Shows the parameters of the module", }, + { + RpcMethod: "SupplierAll", + Use: "list-supplier", + Short: "List all supplier", + }, + { + RpcMethod: "Supplier", + Use: "show-supplier [id]", + Short: "Shows a supplier", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + }, // this line is used by ignite scaffolding # autocli/query }, }, diff --git a/x/supplier/module/debug_container.dot b/x/supplier/module/debug_container.dot new file mode 100644 index 000000000..cb918fde8 --- /dev/null +++ b/x/supplier/module/debug_container.dot @@ -0,0 +1,502 @@ +digraph "" { + subgraph "cluster_auth" { + graph [fontsize="12.0", label="Module: auth", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_authz" { + graph [fontsize="12.0", label="Module: authz", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_bank" { + graph [fontsize="12.0", label="Module: bank", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_circuit" { + graph [fontsize="12.0", label="Module: circuit", penwidth="0.5", style="rounded"]; + "cosmossdk.io/x/circuit.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_consensus" { + graph [fontsize="12.0", label="Module: consensus", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_crisis" { + graph [fontsize="12.0", label="Module: crisis", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_distribution" { + graph [fontsize="12.0", label="Module: distribution", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_evidence" { + graph [fontsize="12.0", label="Module: evidence", penwidth="0.5", style="rounded"]; + "cosmossdk.io/x/evidence.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_feegrant" { + graph [fontsize="12.0", label="Module: feegrant", penwidth="0.5", style="rounded"]; + "cosmossdk.io/x/feegrant/module.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_genutil" { + graph [fontsize="12.0", label="Module: genutil", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_gov" { + graph [fontsize="12.0", label="Module: gov", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_group" { + graph [fontsize="12.0", label="Module: group", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_mint" { + graph [fontsize="12.0", label="Module: mint", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_params" { + graph [fontsize="12.0", label="Module: params", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/params.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_runtime" { + graph [fontsize="12.0", label="Module: runtime", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideBasicManager"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideCometInfoService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideEventService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideGenesisTxHandler"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideHeaderInfoService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreKey"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder"[color="red", fontcolor="red", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_service" { + graph [fontsize="12.0", label="Module: service", penwidth="0.5", style="rounded"]; + "github.com/pokt-network/poktroll/x/service/module.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_slashing" { + graph [fontsize="12.0", label="Module: slashing", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_staking" { + graph [fontsize="12.0", label="Module: staking", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_supplier" { + graph [fontsize="12.0", label="Module: supplier", penwidth="0.5", style="rounded"]; + "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"[color="red", fontcolor="red", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_tx" { + graph [fontsize="12.0", label="Module: tx", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideProtoRegistry"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + } + + subgraph "cluster_upgrade" { + graph [fontsize="12.0", label="Module: upgrade", penwidth="0.5", style="rounded"]; + "cosmossdk.io/x/upgrade.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + subgraph "cluster_vesting" { + graph [fontsize="12.0", label="Module: vesting", penwidth="0.5", style="rounded"]; + "github.com/cosmos/cosmos-sdk/x/auth/vesting.ProvideModule"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5", shape="box"]; + } + + "*cosmossdk.io/api/cosmos/app/runtime/v1alpha1.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/app/v1alpha1.Config"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/auth/module/v1.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/authz/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/bank/module/v1.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/circuit/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/consensus/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/crisis/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/distribution/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/evidence/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/feegrant/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/genutil/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/gov/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/group/module/v1.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/mint/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/params/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/slashing/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/staking/module/v1.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/tx/config/v1.Config"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/api/cosmos/upgrade/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/api/cosmos/vesting/module/v1.Module"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/store/types.KVStoreKey"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/store/types.MemoryStoreKey"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*cosmossdk.io/store/types.TransientStoreKey"[color="black", fontcolor="black", penwidth="1.5"]; + "*cosmossdk.io/x/upgrade/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*github.com/cosmos/cosmos-sdk/baseapp.MsgServiceRouter"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*github.com/cosmos/cosmos-sdk/codec.LegacyAmino"[color="black", fontcolor="black", penwidth="1.5"]; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder"[color="black", fontcolor="black", penwidth="1.5"]; + "*github.com/cosmos/cosmos-sdk/x/crisis/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*github.com/cosmos/cosmos-sdk/x/gov/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "*github.com/pokt-network/poktroll/api/poktroll/service/module.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "*github.com/pokt-network/poktroll/api/poktroll/supplier/module.Module"[color="black", fontcolor="black", penwidth="1.5"]; + "[]cosmossdk.io/x/tx/signing.CustomGetSigner"[color="black", comment="many-per-container", fontcolor="black", penwidth="1.5"]; + "[]github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1.HandlerRoute"[color="lightgrey", comment="many-per-container", fontcolor="dimgrey", penwidth="0.5"]; + "[]runtime.BaseAppOption"[color="lightgrey", comment="many-per-container", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/address.Codec"[color="black", fontcolor="black", penwidth="1.5"]; + "cosmossdk.io/core/appconfig.Compose"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "cosmossdk.io/core/comet.BlockInfoService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/event.Service"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/genesis.TxHandler"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/header.Service"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/store.KVStoreService"[color="black", fontcolor="black", penwidth="1.5"]; + "cosmossdk.io/core/store.MemoryStoreService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/store.TransientStoreService"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/depinject.ModuleKey"[color="black", fontcolor="black", penwidth="1.5"]; + "cosmossdk.io/depinject.OwnModuleKey"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/log.Logger"[color="black", fontcolor="black", penwidth="1.5"]; + "cosmossdk.io/log.nopLogger"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/x/circuit/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/x/evidence/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/x/feegrant.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "cosmossdk.io/x/feegrant.BankKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "cosmossdk.io/x/feegrant/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/x/tx/signing.ProtoFileResolver"[color="black", fontcolor="black", penwidth="1.5"]; + "func() []signing.SignModeHandler"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "func() address.Codec"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "func() runtime.ConsensusAddressCodec"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "func() runtime.ValidatorAddressCodec"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "func() types.AccountI"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/baseapp.MessageRouter"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/client.TxConfig"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/codec.Codec"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/runtime.ConsensusAddressCodec"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/runtime.ValidatorAddressCodec"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/server/types.AppOptions"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig"[color="black", fontcolor="black", penwidth="1.5", shape="hexagon"]; + "github.com/cosmos/cosmos-sdk/x/auth/ante.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/ante.FeegrantKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/exported.Subspace"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/tx.ConfigOptions"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.BankKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/types.BankKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/auth/vesting/types.BankKeeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/authz/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/bank/exported.Subspace"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/bank/types.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/consensus/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/distribution/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/group.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/group.BankKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/group/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/mint/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/params/keeper.Keeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/params/types.Subspace"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/slashing/exported.Subspace"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/slashing/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/cosmos/cosmos-sdk/x/staking/exported.Subspace"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/staking/types.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/cosmos/cosmos-sdk/x/staking/types.BankKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/pokt-network/poktroll/app.AppConfig"[color="black", fontcolor="black", penwidth="1.5", shape="box"]; + "github.com/pokt-network/poktroll/x/service/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/pokt-network/poktroll/x/service/types.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/pokt-network/poktroll/x/service/types.BankKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/pokt-network/poktroll/x/supplier/keeper.Keeper"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "github.com/pokt-network/poktroll/x/supplier/types.AccountKeeper"[color="black", fontcolor="black", penwidth="1.5"]; + "github.com/pokt-network/poktroll/x/supplier/types.BankKeeper"[color="red", fontcolor="red", penwidth="0.5"]; + "google.golang.org/protobuf/reflect/protodesc.Resolver"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "google.golang.org/protobuf/reflect/protoregistry.MessageTypeResolver"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "map[string]cosmossdk.io/core/appmodule.AppModule"[color="red", comment="one-per-module", fontcolor="red", penwidth="0.5"]; + "map[string]github.com/cosmos/cosmos-sdk/types/module.AppModuleBasic"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "map[string]github.com/cosmos/cosmos-sdk/x/params/types.KeyTable"[color="black", comment="one-per-module", fontcolor="black", penwidth="1.5"]; + "map[string]github.com/cosmos/cosmos-sdk/x/staking/types.StakingHooksWrapper"[color="lightgrey", comment="one-per-module", fontcolor="dimgrey", penwidth="0.5"]; + "types.InflationCalculationFn"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "types.RandomGenesisAccountsFn"[color="lightgrey", fontcolor="dimgrey", penwidth="0.5"]; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/app/v1alpha1.Config"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/app/runtime/v1alpha1.Module"; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideApp"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "github.com/cosmos/cosmos-sdk/codec.Codec"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "*github.com/cosmos/cosmos-sdk/codec.LegacyAmino"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "*github.com/cosmos/cosmos-sdk/baseapp.MsgServiceRouter"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "google.golang.org/protobuf/reflect/protodesc.Resolver"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideApp" -> "google.golang.org/protobuf/reflect/protoregistry.MessageTypeResolver"; + "cosmossdk.io/core/address.Codec" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry"; + "github.com/cosmos/cosmos-sdk/runtime.ValidatorAddressCodec" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry"; + "[]cosmossdk.io/x/tx/signing.CustomGetSigner" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry" -> "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry"; + "*cosmossdk.io/api/cosmos/app/runtime/v1alpha1.Module" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey" -> "*cosmossdk.io/store/types.KVStoreKey"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey" -> "*cosmossdk.io/store/types.TransientStoreKey"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreKey"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreKey"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreKey" -> "*cosmossdk.io/store/types.MemoryStoreKey"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideGenesisTxHandler"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideGenesisTxHandler" -> "cosmossdk.io/core/genesis.TxHandler"; + "*cosmossdk.io/api/cosmos/app/runtime/v1alpha1.Module" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService" -> "cosmossdk.io/core/store.KVStoreService"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreService"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreService"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreService" -> "cosmossdk.io/core/store.MemoryStoreService"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreService"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreService"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreService" -> "cosmossdk.io/core/store.TransientStoreService"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideEventService" -> "cosmossdk.io/core/event.Service"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideHeaderInfoService"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideHeaderInfoService" -> "cosmossdk.io/core/header.Service"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideCometInfoService" -> "cosmossdk.io/core/comet.BlockInfoService"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideBasicManager"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideBasicManager" -> "map[string]github.com/cosmos/cosmos-sdk/types/module.AppModuleBasic"; + "*cosmossdk.io/api/cosmos/auth/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec"; + "*cosmossdk.io/api/cosmos/staking/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec"; + "func() address.Codec" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec"; + "func() runtime.ValidatorAddressCodec" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec"; + "func() runtime.ConsensusAddressCodec" -> "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec" -> "cosmossdk.io/core/address.Codec"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec" -> "github.com/cosmos/cosmos-sdk/runtime.ValidatorAddressCodec"; + "github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec" -> "github.com/cosmos/cosmos-sdk/runtime.ConsensusAddressCodec"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/auth/module/v1.Module"; + "*cosmossdk.io/api/cosmos/auth/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "cosmossdk.io/core/address.Codec" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "types.RandomGenesisAccountsFn" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "func() types.AccountI" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/exported.Subspace" -> "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper"; + "github.com/cosmos/cosmos-sdk/x/auth.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/vesting/module/v1.Module"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/auth/vesting.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/vesting/types.BankKeeper" -> "github.com/cosmos/cosmos-sdk/x/auth/vesting.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/vesting.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/bank/module/v1.Module"; + "*cosmossdk.io/api/cosmos/bank/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"; + "cosmossdk.io/log.Logger" -> "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/exported.Subspace" -> "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper"; + "github.com/cosmos/cosmos-sdk/x/bank.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/staking/module/v1.Module"; + "*cosmossdk.io/api/cosmos/staking/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/runtime.ValidatorAddressCodec" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/runtime.ConsensusAddressCodec" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/staking/exported.Subspace" -> "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule" -> "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/staking.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/slashing/module/v1.Module"; + "*cosmossdk.io/api/cosmos/slashing/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/codec.LegacyAmino" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/slashing/exported.Subspace" -> "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/slashing/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule" -> "map[string]github.com/cosmos/cosmos-sdk/x/staking/types.StakingHooksWrapper"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/params/module/v1.Module"; + "*cosmossdk.io/store/types.KVStoreKey" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideModule"; + "*cosmossdk.io/store/types.TransientStoreKey" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/codec.LegacyAmino" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/params.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/params/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/params.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/x/params.ProvideModule" -> "[]github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1.HandlerRoute"; + "cosmossdk.io/depinject.ModuleKey" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace"; + "github.com/cosmos/cosmos-sdk/x/params/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace"; + "map[string]github.com/cosmos/cosmos-sdk/x/params/types.KeyTable" -> "github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace"; + "github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace" -> "github.com/cosmos/cosmos-sdk/x/params/types.Subspace"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/tx/config/v1.Config"; + "*cosmossdk.io/api/cosmos/tx/config/v1.Config" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "cosmossdk.io/core/address.Codec" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/runtime.ValidatorAddressCodec" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "cosmossdk.io/x/tx/signing.ProtoFileResolver" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/ante.FeegrantKeeper" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "func() []signing.SignModeHandler" -> "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule" -> "github.com/cosmos/cosmos-sdk/client.TxConfig"; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/auth/tx.ConfigOptions"; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule" -> "[]runtime.BaseAppOption"; + "github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideProtoRegistry" -> "cosmossdk.io/x/tx/signing.ProtoFileResolver"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/genutil/module/v1.Module"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule"; + "cosmossdk.io/core/genesis.TxHandler" -> "github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule"; + "github.com/cosmos/cosmos-sdk/client.TxConfig" -> "github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/authz/module/v1.Module"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry" -> "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/baseapp.MsgServiceRouter" -> "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/authz/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/upgrade/module/v1.Module"; + "*cosmossdk.io/api/cosmos/upgrade/module/v1.Module" -> "cosmossdk.io/x/upgrade.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "cosmossdk.io/x/upgrade.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "cosmossdk.io/x/upgrade.ProvideModule"; + "cosmossdk.io/core/address.Codec" -> "cosmossdk.io/x/upgrade.ProvideModule"; + "github.com/cosmos/cosmos-sdk/server/types.AppOptions" -> "cosmossdk.io/x/upgrade.ProvideModule"; + "cosmossdk.io/x/upgrade.ProvideModule" -> "*cosmossdk.io/x/upgrade/keeper.Keeper"; + "cosmossdk.io/x/upgrade.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/x/upgrade.ProvideModule" -> "[]runtime.BaseAppOption"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/distribution/module/v1.Module"; + "*cosmossdk.io/api/cosmos/distribution/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/params/types.Subspace" -> "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/distribution/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule" -> "map[string]github.com/cosmos/cosmos-sdk/x/staking/types.StakingHooksWrapper"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/evidence/module/v1.Module"; + "cosmossdk.io/core/store.KVStoreService" -> "cosmossdk.io/x/evidence.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "cosmossdk.io/x/evidence.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper" -> "cosmossdk.io/x/evidence.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/slashing/keeper.Keeper" -> "cosmossdk.io/x/evidence.ProvideModule"; + "cosmossdk.io/core/address.Codec" -> "cosmossdk.io/x/evidence.ProvideModule"; + "cosmossdk.io/core/comet.BlockInfoService" -> "cosmossdk.io/x/evidence.ProvideModule"; + "cosmossdk.io/x/evidence.ProvideModule" -> "cosmossdk.io/x/evidence/keeper.Keeper"; + "cosmossdk.io/x/evidence.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/mint/module/v1.Module"; + "cosmossdk.io/depinject.OwnModuleKey" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "*cosmossdk.io/api/cosmos/mint/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "types.InflationCalculationFn" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/params/types.Subspace" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/mint/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/mint.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/group/module/v1.Module"; + "*cosmossdk.io/api/cosmos/group/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "*cosmossdk.io/store/types.KVStoreKey" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/baseapp.MsgServiceRouter" -> "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/group/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/feegrant/module/v1.Module"; + "cosmossdk.io/core/store.KVStoreService" -> "cosmossdk.io/x/feegrant/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "cosmossdk.io/x/feegrant/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "cosmossdk.io/x/feegrant/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "cosmossdk.io/x/feegrant/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry" -> "cosmossdk.io/x/feegrant/module.ProvideModule"; + "cosmossdk.io/x/feegrant/module.ProvideModule" -> "cosmossdk.io/x/feegrant/keeper.Keeper"; + "cosmossdk.io/x/feegrant/module.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/gov/module/v1.Module"; + "*cosmossdk.io/api/cosmos/gov/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "cosmossdk.io/depinject.OwnModuleKey" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/baseapp.MsgServiceRouter" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "*github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/distribution/keeper.Keeper" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/params/types.Subspace" -> "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule" -> "*github.com/cosmos/cosmos-sdk/x/gov/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/gov.ProvideModule" -> "[]github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1.HandlerRoute"; + "github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable" -> "map[string]github.com/cosmos/cosmos-sdk/x/params/types.KeyTable"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/crisis/module/v1.Module"; + "*cosmossdk.io/api/cosmos/crisis/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "github.com/cosmos/cosmos-sdk/server/types.AppOptions" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "cosmossdk.io/core/address.Codec" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/params/types.Subspace" -> "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule" -> "*github.com/cosmos/cosmos-sdk/x/crisis/keeper.Keeper"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/consensus/module/v1.Module"; + "*cosmossdk.io/api/cosmos/consensus/module/v1.Module" -> "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule"; + "cosmossdk.io/core/event.Service" -> "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule" -> "github.com/cosmos/cosmos-sdk/x/consensus/keeper.Keeper"; + "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule" -> "[]runtime.BaseAppOption"; + "cosmossdk.io/core/appconfig.Compose" -> "*cosmossdk.io/api/cosmos/circuit/module/v1.Module"; + "*cosmossdk.io/api/cosmos/circuit/module/v1.Module" -> "cosmossdk.io/x/circuit.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "cosmossdk.io/x/circuit.ProvideModule"; + "cosmossdk.io/core/store.KVStoreService" -> "cosmossdk.io/x/circuit.ProvideModule"; + "cosmossdk.io/core/address.Codec" -> "cosmossdk.io/x/circuit.ProvideModule"; + "cosmossdk.io/x/circuit.ProvideModule" -> "cosmossdk.io/x/circuit/keeper.Keeper"; + "cosmossdk.io/x/circuit.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/x/circuit.ProvideModule" -> "[]runtime.BaseAppOption"; + "cosmossdk.io/core/appconfig.Compose" -> "*github.com/pokt-network/poktroll/api/poktroll/service/module.Module"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/pokt-network/poktroll/x/service/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/pokt-network/poktroll/x/service/module.ProvideModule"; + "*github.com/pokt-network/poktroll/api/poktroll/service/module.Module" -> "github.com/pokt-network/poktroll/x/service/module.ProvideModule"; + "cosmossdk.io/log.Logger" -> "github.com/pokt-network/poktroll/x/service/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/pokt-network/poktroll/x/service/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper" -> "github.com/pokt-network/poktroll/x/service/module.ProvideModule"; + "github.com/pokt-network/poktroll/x/service/module.ProvideModule" -> "github.com/pokt-network/poktroll/x/service/keeper.Keeper"; + "github.com/pokt-network/poktroll/x/service/module.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "cosmossdk.io/core/appconfig.Compose" -> "*github.com/pokt-network/poktroll/api/poktroll/supplier/module.Module"; + "cosmossdk.io/core/store.KVStoreService" -> "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"; + "*github.com/pokt-network/poktroll/api/poktroll/supplier/module.Module" -> "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"; + "cosmossdk.io/log.Logger" -> "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"; + "github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper" -> "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"; + "github.com/pokt-network/poktroll/x/supplier/types.BankKeeper" -> "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule"; + "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule" -> "github.com/pokt-network/poktroll/x/supplier/keeper.Keeper"; + "github.com/pokt-network/poktroll/x/supplier/module.ProvideModule" -> "map[string]cosmossdk.io/core/appmodule.AppModule"; + "github.com/pokt-network/poktroll/app.AppConfig" -> "map[string]github.com/cosmos/cosmos-sdk/types/module.AppModuleBasic"; + "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig" -> "cosmossdk.io/log.nopLogger"; + "*github.com/cosmos/cosmos-sdk/runtime.AppBuilder" -> "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig"; + "github.com/cosmos/cosmos-sdk/client.TxConfig" -> "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig"; + "github.com/cosmos/cosmos-sdk/codec.Codec" -> "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig"; + "*github.com/cosmos/cosmos-sdk/codec.LegacyAmino" -> "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig"; + "github.com/cosmos/cosmos-sdk/codec/types.InterfaceRegistry" -> "github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig"; +} + diff --git a/x/supplier/module/debug_container.log b/x/supplier/module/debug_container.log new file mode 100644 index 000000000..099d5cb93 --- /dev/null +++ b/x/supplier/module/debug_container.log @@ -0,0 +1,379 @@ +Initializing logger +Registering providers + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) + Registering resolver for simple type codec.Codec + Registering resolver for simple type *codec.LegacyAmino + Registering resolver for simple type *runtime.AppBuilder + Registering resolver for simple type *baseapp.MsgServiceRouter + Registering resolver for one-per-module type appmodule.AppModule + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering resolver for simple type protodesc.Resolver + Registering resolver for simple type protoregistry.MessageTypeResolver + Registering resolver for many-per-container type signing.CustomGetSigner + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) + Registering resolver for simple type types.InterfaceRegistry + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) + Registering resolver for module-scoped type *types.KVStoreKey + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:213) + Registering resolver for module-scoped type *types.TransientStoreKey + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:219) + Registering resolver for module-scoped type *types.MemoryStoreKey + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideGenesisTxHandler (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:226) + Registering resolver for simple type genesis.TxHandler + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Registering resolver for module-scoped type store.KVStoreService + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/runtime.ProvideMemoryStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:234) + Registering resolver for module-scoped type store.MemoryStoreService + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:239) + Registering resolver for module-scoped type store.TransientStoreService + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideEventService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:244) + Registering resolver for simple type event.Service + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideHeaderInfoService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:253) + Registering resolver for simple type header.Service + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideCometInfoService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:249) + Registering resolver for simple type comet.BlockInfoService + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideBasicManager (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:257) + Registering resolver for simple type module.BasicManager + Registering github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) + Registering resolver for simple type address.Codec + Registering resolver for simple type runtime.ValidatorAddressCodec + Registering resolver for simple type runtime.ConsensusAddressCodec + Registering github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + Registering resolver for simple type keeper.AccountKeeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering github.com/cosmos/cosmos-sdk/x/auth/vesting.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/vesting/module.go:140) + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Registering github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) + Registering resolver for simple type keeper.BaseKeeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Registering github.com/cosmos/cosmos-sdk/x/staking.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/staking/module.go:221) + Registering resolver for simple type *keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Implicitly registering resolver *keeper.Keeper for interface type types.StakingKeeper + Registering github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/slashing/module.go:230) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering resolver for one-per-module type types.StakingHooksWrapper + Found resolver for types.StakingHooksWrapper: *depinject.onePerModuleResolver + Registering github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering resolver for many-per-container type v1beta1.HandlerRoute + Found resolver for v1beta1.HandlerRoute: *depinject.groupResolver + Registering resolver for one-per-module type types.KeyTable + Registering module-scoped provider: github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Registering resolver for module-scoped type types.Subspace + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type tx.BankKeeper + Implicitly registering resolver keeper.AccountKeeper for interface type ante.AccountKeeper + Registering github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:68) + Registering resolver for simple type client.TxConfig + Registering resolver for simple type tx.ConfigOptions + Registering resolver for many-per-container type runtime.BaseAppOption + Found resolver for runtime.BaseAppOption: *depinject.groupResolver + Registering github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideProtoRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:65) + Registering resolver for simple type signing.ProtoFileResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver *keeper.Keeper for interface type types.StakingKeeper + Registering github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/genutil/module.go:138) + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type authz.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type authz.BankKeeper + Implicitly registering resolver *baseapp.MsgServiceRouter for interface type baseapp.MessageRouter + Registering github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/authz/module/module.go:178) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering cosmossdk.io/x/upgrade.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/upgrade@v0.1.1/module.go:194) + Registering resolver for simple type *keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Found resolver for runtime.BaseAppOption: *depinject.groupResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Implicitly registering resolver *keeper.Keeper for interface type types.StakingKeeper + Implicitly registering resolver types.Subspace for interface type exported.Subspace + Registering github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/distribution/module.go:232) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Found resolver for types.StakingHooksWrapper: *depinject.onePerModuleResolver + Implicitly registering resolver *keeper.Keeper for interface type types.StakingKeeper + Implicitly registering resolver keeper.Keeper for interface type types.SlashingKeeper + Registering cosmossdk.io/x/evidence.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/evidence@v0.1.0/module.go:210) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver types.Subspace for interface type exported.Subspace + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Implicitly registering resolver *keeper.Keeper for interface type types.StakingKeeper + Registering github.com/cosmos/cosmos-sdk/x/mint.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/mint/module.go:221) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type group.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type group.BankKeeper + Registering github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/group/module/module.go:208) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type feegrant.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type feegrant.BankKeeper + Registering cosmossdk.io/x/feegrant/module.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/feegrant@v0.1.0/module/module.go:184) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Implicitly registering resolver *keeper.Keeper for interface type types.StakingKeeper + Implicitly registering resolver keeper.Keeper for interface type types.DistributionKeeper + Implicitly registering resolver types.Subspace for interface type types.ParamSubspace + Registering github.com/cosmos/cosmos-sdk/x/gov.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:189) + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering resolver for simple type *keeper.Keeper + Found resolver for v1beta1.HandlerRoute: *depinject.groupResolver + Registering github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:218) + Found resolver for types.KeyTable: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.BaseKeeper for interface type types.SupplyKeeper + Implicitly registering resolver types.Subspace for interface type exported.Subspace + Registering github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/crisis/module.go:201) + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Registering resolver for simple type *keeper.Keeper + Registering github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/consensus/module.go:117) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Found resolver for runtime.BaseAppOption: *depinject.groupResolver + Registering cosmossdk.io/x/circuit.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/circuit@v0.1.0/module.go:154) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Found resolver for runtime.BaseAppOption: *depinject.groupResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Implicitly registering resolver keeper.BaseKeeper for interface type types.BankKeeper + Registering github.com/pokt-network/poktroll/x/service/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/service/module/module.go:194) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver + Implicitly registering resolver keeper.AccountKeeper for interface type types.AccountKeeper + Registering github.com/pokt-network/poktroll/x/supplier/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/supplier/module/module.go:194) + Registering resolver for simple type keeper.Keeper + Found resolver for appmodule.AppModule: *depinject.onePerModuleResolver +Registering outputs + Registering github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:186) +Building container +Resolving dependencies for github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:186) + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) + Providing types.InterfaceRegistry from github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) to github.com/cosmos/cosmos-sdk/runtime.ProvideApp + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) + Providing address.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) + Supplying *modulev1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec + Supplying *modulev1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec + Providing zero value for optional dependency func() address.Codec + Providing zero value for optional dependency func() runtime.ValidatorAddressCodec + Providing zero value for optional dependency func() runtime.ConsensusAddressCodec + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) + Providing runtime.ValidatorAddressCodec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry + Providing many-per-container type slice []signing.CustomGetSigner to github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry from: + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) + Providing client.TxConfig from github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:68) to github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:68) + Supplying *configv1.Config from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Providing address.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Providing runtime.ValidatorAddressCodec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Providing signing.ProtoFileResolver from github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideProtoRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:65) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideProtoRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:65) + Calling github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideProtoRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:65) + Providing keeper.BaseKeeper from github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) + Supplying *modulev1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/x/bank.ProvideModule + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/bank.ProvideModule + Providing store.KVStoreService from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) to github.com/cosmos/cosmos-sdk/x/bank.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Providing ModuleKey bank + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Implicitly registering resolver log.nopLogger for interface type log.Logger + Supplying log.nopLogger from github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:189) to github.com/cosmos/cosmos-sdk/x/bank.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to github.com/cosmos/cosmos-sdk/x/bank.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + Supplying *modulev1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/x/auth.ProvideModule + Providing store.KVStoreService from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) to github.com/cosmos/cosmos-sdk/x/auth.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Providing ModuleKey auth + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/auth.ProvideModule + Providing address.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/x/auth.ProvideModule + Providing zero value for optional dependency types.RandomGenesisAccountsFn + Providing zero value for optional dependency func() types.AccountI + Implicitly registering resolver types.Subspace for interface type exported.Subspace + Providing types.Subspace from github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) to github.com/cosmos/cosmos-sdk/x/auth.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Providing ModuleKey auth + Providing keeper.Keeper from github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) to github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) + Providing *types.KVStoreKey from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) to github.com/cosmos/cosmos-sdk/x/params.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey + Providing ModuleKey params + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) + Providing *types.TransientStoreKey from github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:213) to github.com/cosmos/cosmos-sdk/x/params.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:213) + Providing ModuleKey params + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideTransientStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:213) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/params.ProvideModule + Providing *codec.LegacyAmino from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/params.ProvideModule + Calling github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) + Providing one-per-module type map map[string]types.KeyTable to github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace from: + gov: github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:218) + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:218) + Calling github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:218) + Calling github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Calling github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + Implicitly registering resolver types.Subspace for interface type exported.Subspace + Providing types.Subspace from github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) to github.com/cosmos/cosmos-sdk/x/bank.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Providing ModuleKey bank + Providing keeper.Keeper from github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) to github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace + Providing one-per-module type map map[string]types.KeyTable to github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace from: + gov: github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:218) + Calling github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Calling github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) + Providing keeper.BaseKeeper from github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Implicitly registering resolver keeper.Keeper for interface type ante.FeegrantKeeper + Providing keeper.Keeper from cosmossdk.io/x/feegrant/module.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/feegrant@v0.1.0/module/module.go:184) to github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule + Resolving dependencies for cosmossdk.io/x/feegrant/module.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/feegrant@v0.1.0/module/module.go:184) + Providing store.KVStoreService from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) to cosmossdk.io/x/feegrant/module.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Providing ModuleKey feegrant + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to cosmossdk.io/x/feegrant/module.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to cosmossdk.io/x/feegrant/module.ProvideModule + Providing keeper.BaseKeeper from github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) to cosmossdk.io/x/feegrant/module.ProvideModule + Providing types.InterfaceRegistry from github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) to cosmossdk.io/x/feegrant/module.ProvideModule + Calling cosmossdk.io/x/feegrant/module.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/feegrant@v0.1.0/module/module.go:184) + Providing zero value for optional dependency func() []signing.SignModeHandler + Calling github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:68) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig + Providing *codec.LegacyAmino from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig + Providing types.InterfaceRegistry from github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) to github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig +Calling github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:186) +Done building container +Calling invokers +Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:138) + Supplying *appv1alpha1.Config from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:55) to github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder + Providing one-per-module type map map[string]appmodule.AppModule to github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder from: + distribution: github.com/cosmos/cosmos-sdk/x/distribution.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/distribution/module.go:232) + crisis: github.com/cosmos/cosmos-sdk/x/crisis.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/crisis/module.go:201) + consensus: github.com/cosmos/cosmos-sdk/x/consensus.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/consensus/module.go:117) + runtime: github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) + bank: github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) + slashing: github.com/cosmos/cosmos-sdk/x/slashing.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/slashing/module.go:230) + genutil: github.com/cosmos/cosmos-sdk/x/genutil.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/genutil/module.go:138) + authz: github.com/cosmos/cosmos-sdk/x/authz/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/authz/module/module.go:178) + mint: github.com/cosmos/cosmos-sdk/x/mint.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/mint/module.go:221) + gov: github.com/cosmos/cosmos-sdk/x/gov.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:189) + circuit: cosmossdk.io/x/circuit.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/circuit@v0.1.0/module.go:154) + auth: github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + staking: github.com/cosmos/cosmos-sdk/x/staking.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/staking/module.go:221) + feegrant: cosmossdk.io/x/feegrant/module.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/feegrant@v0.1.0/module/module.go:184) + vesting: github.com/cosmos/cosmos-sdk/x/auth/vesting.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/vesting/module.go:140) + params: github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) + upgrade: cosmossdk.io/x/upgrade.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/upgrade@v0.1.1/module.go:194) + evidence: cosmossdk.io/x/evidence.ProvideModule (/home/bwhite/go/pkg/mod/cosmossdk.io/x/evidence@v0.1.0/module.go:210) + group: github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/group/module/module.go:208) + service: github.com/pokt-network/poktroll/x/service/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/service/module/module.go:194) + supplier: github.com/pokt-network/poktroll/x/supplier/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/supplier/module/module.go:194) + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/staking.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/staking/module.go:221) + Supplying *modulev1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Providing runtime.ValidatorAddressCodec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Providing runtime.ConsensusAddressCodec from github.com/cosmos/cosmos-sdk/runtime.ProvideAddressCodec (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:281) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Providing keeper.BaseKeeper from github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Providing store.KVStoreService from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Providing ModuleKey staking + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Implicitly registering resolver types.Subspace for interface type exported.Subspace + Providing types.Subspace from github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) to github.com/cosmos/cosmos-sdk/x/staking.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Providing ModuleKey staking + Providing keeper.Keeper from github.com/cosmos/cosmos-sdk/x/params.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:129) to github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace + Providing one-per-module type map map[string]types.KeyTable to github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace from: + gov: github.com/cosmos/cosmos-sdk/x/gov.ProvideKeyTable (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/gov/module.go:218) + Calling github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + Calling github.com/cosmos/cosmos-sdk/x/staking.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/staking/module.go:221) + Resolving dependencies for github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/group/module/module.go:208) + Supplying *modulev1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Providing *types.KVStoreKey from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey + Providing ModuleKey group + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreKey (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:198) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Providing keeper.BaseKeeper from github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Providing types.InterfaceRegistry from github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Providing *baseapp.MsgServiceRouter from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule + Calling github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/group/module/module.go:208) + Resolving dependencies for github.com/pokt-network/poktroll/x/service/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/service/module/module.go:194) + Providing store.KVStoreService from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) to github.com/pokt-network/poktroll/x/service/module.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Providing ModuleKey service + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/pokt-network/poktroll/x/service/module.ProvideModule + Supplying *module.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/pokt-network/poktroll/x/service/module.ProvideModule + Supplying log.nopLogger from github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:189) to github.com/pokt-network/poktroll/x/service/module.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to github.com/pokt-network/poktroll/x/service/module.ProvideModule + Providing keeper.BaseKeeper from github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) to github.com/pokt-network/poktroll/x/service/module.ProvideModule + Calling github.com/pokt-network/poktroll/x/service/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/service/module/module.go:194) + Resolving dependencies for github.com/pokt-network/poktroll/x/supplier/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/supplier/module/module.go:194) + Providing store.KVStoreService from github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) to github.com/pokt-network/poktroll/x/supplier/module.ProvideModule + Resolving dependencies for github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Supplying *runtimev1alpha1.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Providing ModuleKey supplier + Providing *runtime.AppBuilder from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService + Calling github.com/cosmos/cosmos-sdk/runtime.ProvideKVStoreService (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:229) + Providing codec.Codec from github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) to github.com/pokt-network/poktroll/x/supplier/module.ProvideModule + Supplying *module.Module from cosmossdk.io/core/appconfig.Compose (/home/bwhite/go/pkg/mod/cosmossdk.io/core@v0.11.0/appconfig/config.go:95) to github.com/pokt-network/poktroll/x/supplier/module.ProvideModule + Supplying log.nopLogger from github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:189) to github.com/pokt-network/poktroll/x/supplier/module.ProvideModule + Providing keeper.AccountKeeper from github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) to github.com/pokt-network/poktroll/x/supplier/module.ProvideModule + Error: can't resolve type github.com/pokt-network/poktroll/x/supplier/types/types.BankKeeper for github.com/pokt-network/poktroll/x/supplier/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/supplier/module/module.go:194): + while resolving: + types.BankKeeper for github.com/pokt-network/poktroll/x/supplier/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/supplier/module/module.go:194) + store.KVStoreService for github.com/pokt-network/poktroll/x/supplier/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/supplier/module/module.go:194) + store.KVStoreService for github.com/pokt-network/poktroll/x/service/module.ProvideModule (/home/bwhite/Projects/pokt/poktroll/x/service/module/module.go:194) + *types.KVStoreKey for github.com/cosmos/cosmos-sdk/x/group/module.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/group/module/module.go:208) + exported.Subspace for github.com/cosmos/cosmos-sdk/x/staking.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/staking/module.go:221) + store.KVStoreService for github.com/cosmos/cosmos-sdk/x/staking.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/staking/module.go:221) + map[string]appmodule.AppModule for github.com/cosmos/cosmos-sdk/runtime.SetupAppBuilder (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:138) + ante.FeegrantKeeper for github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:68) + depinject.ModuleKey for github.com/cosmos/cosmos-sdk/x/params.ProvideSubspace (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/params/module.go:146) + exported.Subspace for github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + func() types.AccountI for github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + types.RandomGenesisAccountsFn for github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + store.KVStoreService for github.com/cosmos/cosmos-sdk/x/auth.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/module.go:209) + types.AccountKeeper for github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) + store.KVStoreService for github.com/cosmos/cosmos-sdk/x/bank.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/bank/module.go:227) + types.BankKeeper for github.com/cosmos/cosmos-sdk/x/auth/tx/config.ProvideModule (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/x/auth/tx/config/config.go:68) + client.TxConfig for github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:186) + address.Codec for github.com/cosmos/cosmos-sdk/runtime.ProvideInterfaceRegistry (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:161) + types.InterfaceRegistry for github.com/cosmos/cosmos-sdk/runtime.ProvideApp (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/runtime/module.go:84) + *runtime.AppBuilder for github.com/cosmos/cosmos-sdk/testutil/network.DefaultConfigWithAppConfig (/home/bwhite/go/pkg/mod/github.com/rollkit/cosmos-sdk@v0.50.1-rollkit-v0.11.19-no-fraud-proofs/testutil/network/network.go:186) + Saved graph of container to /home/bwhite/Projects/pokt/poktroll/x/supplier/module/debug_container.dot diff --git a/x/supplier/module/genesis.go b/x/supplier/module/genesis.go index 7c12c8a1d..f0a857fe4 100644 --- a/x/supplier/module/genesis.go +++ b/x/supplier/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 supplier + for _, elem := range genState.SupplierList { + k.SetSupplier(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.SupplierList = k.GetAllSupplier(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/supplier/module/genesis_test.go b/x/supplier/module/genesis_test.go index 3c1559a34..4d931b698 100644 --- a/x/supplier/module/genesis_test.go +++ b/x/supplier/module/genesis_test.go @@ -14,6 +14,14 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), + SupplierList: []types.Supplier{ + { + Index: "0", + }, + { + Index: "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.SupplierList, got.SupplierList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go index 0af9b4416..f6bd94129 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/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{ + SupplierList: []Supplier{}, // 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 supplier + supplierIndexMap := make(map[string]struct{}) + + for _, elem := range gs.SupplierList { + index := string(SupplierKey(elem.Index)) + if _, ok := supplierIndexMap[index]; ok { + return fmt.Errorf("duplicated index for supplier") + } + supplierIndexMap[index] = struct{}{} + } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.Validate() diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index ee12da6e2..a7a5f4e06 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/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{ + SupplierList: []types.Supplier{ + { + Index: "0", + }, + { + Index: "1", + }, + }, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, }, + { + desc: "duplicated supplier", + genState: &types.GenesisState{ + SupplierList: []types.Supplier{ + { + Index: "0", + }, + { + Index: "0", + }, + }, + }, + valid: false, + }, // this line is used by starport scaffolding # types/genesis/testcase } for _, tc := range tests { diff --git a/x/supplier/types/key_supplier.go b/x/supplier/types/key_supplier.go index 20f28a5c1..e91fd76e4 100644 --- a/x/supplier/types/key_supplier.go +++ b/x/supplier/types/key_supplier.go @@ -11,12 +11,12 @@ const ( // SupplierKey returns the store key to retrieve a Supplier from the index fields func SupplierKey( - address string, + index string, ) []byte { var key []byte - addressBytes := []byte(address) - key = append(key, addressBytes...) + indexBytes := []byte(index) + key = append(key, indexBytes...) key = append(key, []byte("/")...) return key From 0be76bd1dd5415bba84e6e19f9ac26d262ba3bbb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 8 Feb 2024 14:22:34 +0100 Subject: [PATCH 03/23] chore: move supplier.proto to shared --- .../{supplier => shared}/supplier.pulsar.go | 199 +++++++++--------- api/poktroll/supplier/genesis.pulsar.go | 78 +++---- api/poktroll/supplier/query.pulsar.go | 192 ++++++++--------- proto/buf.gen.pulsar.yaml | 22 ++ .../{supplier => shared}/supplier.proto | 4 +- proto/poktroll/supplier/genesis.proto | 8 +- proto/poktroll/supplier/query.proto | 8 +- x/supplier/keeper/query_supplier.go | 8 +- 8 files changed, 271 insertions(+), 248 deletions(-) rename api/poktroll/{supplier => shared}/supplier.pulsar.go (77%) create mode 100644 proto/buf.gen.pulsar.yaml rename proto/poktroll/{supplier => shared}/supplier.proto (72%) diff --git a/api/poktroll/supplier/supplier.pulsar.go b/api/poktroll/shared/supplier.pulsar.go similarity index 77% rename from api/poktroll/supplier/supplier.pulsar.go rename to api/poktroll/shared/supplier.pulsar.go index ae580c72d..ee0b7abd4 100644 --- a/api/poktroll/supplier/supplier.pulsar.go +++ b/api/poktroll/shared/supplier.pulsar.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package supplier +package shared import ( v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" @@ -23,8 +23,8 @@ var ( ) func init() { - file_poktroll_supplier_supplier_proto_init() - md_Supplier = File_poktroll_supplier_supplier_proto.Messages().ByName("Supplier") + file_poktroll_shared_supplier_proto_init() + md_Supplier = File_poktroll_shared_supplier_proto.Messages().ByName("Supplier") fd_Supplier_index = md_Supplier.Fields().ByName("index") fd_Supplier_address = md_Supplier.Fields().ByName("address") fd_Supplier_stake = md_Supplier.Fields().ByName("stake") @@ -40,7 +40,7 @@ func (x *Supplier) ProtoReflect() protoreflect.Message { } func (x *Supplier) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_supplier_supplier_proto_msgTypes[0] + mi := &file_poktroll_shared_supplier_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -135,19 +135,19 @@ func (x *fastReflection_Supplier) Range(f func(protoreflect.FieldDescriptor, pro // a repeated field is populated if it is non-empty. func (x *fastReflection_Supplier) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.supplier.Supplier.index": + case "poktroll.shared.Supplier.index": return x.Index != "" - case "poktroll.supplier.Supplier.address": + case "poktroll.shared.Supplier.address": return x.Address != "" - case "poktroll.supplier.Supplier.stake": + case "poktroll.shared.Supplier.stake": return x.Stake != nil - case "poktroll.supplier.Supplier.services": + case "poktroll.shared.Supplier.services": return x.Services != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) } - panic(fmt.Errorf("message poktroll.supplier.Supplier does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) } } @@ -159,19 +159,19 @@ func (x *fastReflection_Supplier) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Supplier) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.supplier.Supplier.index": + case "poktroll.shared.Supplier.index": x.Index = "" - case "poktroll.supplier.Supplier.address": + case "poktroll.shared.Supplier.address": x.Address = "" - case "poktroll.supplier.Supplier.stake": + case "poktroll.shared.Supplier.stake": x.Stake = nil - case "poktroll.supplier.Supplier.services": + case "poktroll.shared.Supplier.services": x.Services = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) } - panic(fmt.Errorf("message poktroll.supplier.Supplier does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) } } @@ -183,23 +183,23 @@ func (x *fastReflection_Supplier) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Supplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.supplier.Supplier.index": + case "poktroll.shared.Supplier.index": value := x.Index return protoreflect.ValueOfString(value) - case "poktroll.supplier.Supplier.address": + case "poktroll.shared.Supplier.address": value := x.Address return protoreflect.ValueOfString(value) - case "poktroll.supplier.Supplier.stake": + case "poktroll.shared.Supplier.stake": value := x.Stake return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "poktroll.supplier.Supplier.services": + case "poktroll.shared.Supplier.services": value := x.Services return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) } - panic(fmt.Errorf("message poktroll.supplier.Supplier does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", descriptor.FullName())) } } @@ -215,19 +215,19 @@ func (x *fastReflection_Supplier) Get(descriptor protoreflect.FieldDescriptor) p // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Supplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.supplier.Supplier.index": + case "poktroll.shared.Supplier.index": x.Index = value.Interface().(string) - case "poktroll.supplier.Supplier.address": + case "poktroll.shared.Supplier.address": x.Address = value.Interface().(string) - case "poktroll.supplier.Supplier.stake": + case "poktroll.shared.Supplier.stake": x.Stake = value.Message().Interface().(*v1beta1.Coin) - case "poktroll.supplier.Supplier.services": + case "poktroll.shared.Supplier.services": x.Services = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) } - panic(fmt.Errorf("message poktroll.supplier.Supplier does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) } } @@ -243,22 +243,22 @@ func (x *fastReflection_Supplier) Set(fd protoreflect.FieldDescriptor, value pro // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Supplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.Supplier.stake": + case "poktroll.shared.Supplier.stake": if x.Stake == nil { x.Stake = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) - case "poktroll.supplier.Supplier.index": - panic(fmt.Errorf("field index of message poktroll.supplier.Supplier is not mutable")) - case "poktroll.supplier.Supplier.address": - panic(fmt.Errorf("field address of message poktroll.supplier.Supplier is not mutable")) - case "poktroll.supplier.Supplier.services": - panic(fmt.Errorf("field services of message poktroll.supplier.Supplier is not mutable")) + case "poktroll.shared.Supplier.index": + panic(fmt.Errorf("field index of message poktroll.shared.Supplier is not mutable")) + case "poktroll.shared.Supplier.address": + panic(fmt.Errorf("field address of message poktroll.shared.Supplier is not mutable")) + case "poktroll.shared.Supplier.services": + panic(fmt.Errorf("field services of message poktroll.shared.Supplier is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) } - panic(fmt.Errorf("message poktroll.supplier.Supplier does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) } } @@ -267,20 +267,20 @@ func (x *fastReflection_Supplier) Mutable(fd protoreflect.FieldDescriptor) proto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Supplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.Supplier.index": + case "poktroll.shared.Supplier.index": return protoreflect.ValueOfString("") - case "poktroll.supplier.Supplier.address": + case "poktroll.shared.Supplier.address": return protoreflect.ValueOfString("") - case "poktroll.supplier.Supplier.stake": + case "poktroll.shared.Supplier.stake": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.supplier.Supplier.services": + case "poktroll.shared.Supplier.services": return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Supplier")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) } - panic(fmt.Errorf("message poktroll.supplier.Supplier does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) } } @@ -290,7 +290,7 @@ func (x *fastReflection_Supplier) NewField(fd protoreflect.FieldDescriptor) prot func (x *fastReflection_Supplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.Supplier", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.Supplier", d.FullName())) } panic("unreachable") } @@ -645,7 +645,7 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { // versions: // protoc-gen-go v1.27.0 // protoc (unknown) -// source: poktroll/supplier/supplier.proto +// source: poktroll/shared/supplier.proto const ( // Verify that this generated code is sufficiently up-to-date. @@ -668,7 +668,7 @@ type Supplier struct { func (x *Supplier) Reset() { *x = Supplier{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_supplier_supplier_proto_msgTypes[0] + mi := &file_poktroll_shared_supplier_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -682,7 +682,7 @@ func (*Supplier) ProtoMessage() {} // Deprecated: Use Supplier.ProtoReflect.Descriptor instead. func (*Supplier) Descriptor() ([]byte, []int) { - return file_poktroll_supplier_supplier_proto_rawDescGZIP(), []int{0} + return file_poktroll_shared_supplier_proto_rawDescGZIP(), []int{0} } func (x *Supplier) GetIndex() string { @@ -713,58 +713,57 @@ func (x *Supplier) GetServices() string { return "" } -var File_poktroll_supplier_supplier_proto protoreflect.FileDescriptor - -var file_poktroll_supplier_supplier_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x8d, 0x01, 0x0a, 0x08, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xaf, 0x01, 0x0a, 0x15, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, - 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, +var File_poktroll_shared_supplier_proto protoreflect.FileDescriptor + +var file_poktroll_shared_supplier_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 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, 0x8d, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, + 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_poktroll_supplier_supplier_proto_rawDescOnce sync.Once - file_poktroll_supplier_supplier_proto_rawDescData = file_poktroll_supplier_supplier_proto_rawDesc + file_poktroll_shared_supplier_proto_rawDescOnce sync.Once + file_poktroll_shared_supplier_proto_rawDescData = file_poktroll_shared_supplier_proto_rawDesc ) -func file_poktroll_supplier_supplier_proto_rawDescGZIP() []byte { - file_poktroll_supplier_supplier_proto_rawDescOnce.Do(func() { - file_poktroll_supplier_supplier_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_supplier_proto_rawDescData) +func file_poktroll_shared_supplier_proto_rawDescGZIP() []byte { + file_poktroll_shared_supplier_proto_rawDescOnce.Do(func() { + file_poktroll_shared_supplier_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_shared_supplier_proto_rawDescData) }) - return file_poktroll_supplier_supplier_proto_rawDescData + return file_poktroll_shared_supplier_proto_rawDescData } -var file_poktroll_supplier_supplier_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_poktroll_supplier_supplier_proto_goTypes = []interface{}{ - (*Supplier)(nil), // 0: poktroll.supplier.Supplier +var file_poktroll_shared_supplier_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_shared_supplier_proto_goTypes = []interface{}{ + (*Supplier)(nil), // 0: poktroll.shared.Supplier (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } -var file_poktroll_supplier_supplier_proto_depIdxs = []int32{ - 1, // 0: poktroll.supplier.Supplier.stake:type_name -> cosmos.base.v1beta1.Coin +var file_poktroll_shared_supplier_proto_depIdxs = []int32{ + 1, // 0: poktroll.shared.Supplier.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 @@ -772,13 +771,13 @@ var file_poktroll_supplier_supplier_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_poktroll_supplier_supplier_proto_init() } -func file_poktroll_supplier_supplier_proto_init() { - if File_poktroll_supplier_supplier_proto != nil { +func init() { file_poktroll_shared_supplier_proto_init() } +func file_poktroll_shared_supplier_proto_init() { + if File_poktroll_shared_supplier_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_poktroll_supplier_supplier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_poktroll_shared_supplier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Supplier); i { case 0: return &v.state @@ -795,18 +794,18 @@ func file_poktroll_supplier_supplier_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_poktroll_supplier_supplier_proto_rawDesc, + RawDescriptor: file_poktroll_shared_supplier_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_poktroll_supplier_supplier_proto_goTypes, - DependencyIndexes: file_poktroll_supplier_supplier_proto_depIdxs, - MessageInfos: file_poktroll_supplier_supplier_proto_msgTypes, + GoTypes: file_poktroll_shared_supplier_proto_goTypes, + DependencyIndexes: file_poktroll_shared_supplier_proto_depIdxs, + MessageInfos: file_poktroll_shared_supplier_proto_msgTypes, }.Build() - File_poktroll_supplier_supplier_proto = out.File - file_poktroll_supplier_supplier_proto_rawDesc = nil - file_poktroll_supplier_supplier_proto_goTypes = nil - file_poktroll_supplier_supplier_proto_depIdxs = nil + File_poktroll_shared_supplier_proto = out.File + file_poktroll_shared_supplier_proto_rawDesc = nil + file_poktroll_shared_supplier_proto_goTypes = nil + file_poktroll_shared_supplier_proto_depIdxs = nil } diff --git a/api/poktroll/supplier/genesis.pulsar.go b/api/poktroll/supplier/genesis.pulsar.go index 9e9b76ad8..86a864a41 100644 --- a/api/poktroll/supplier/genesis.pulsar.go +++ b/api/poktroll/supplier/genesis.pulsar.go @@ -6,6 +6,7 @@ import ( fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -17,7 +18,7 @@ import ( var _ protoreflect.List = (*_GenesisState_2_list)(nil) type _GenesisState_2_list struct { - list *[]*Supplier + list *[]*shared.Supplier } func (x *_GenesisState_2_list) Len() int { @@ -33,18 +34,18 @@ func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Supplier) + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) (*x.list)[i] = concreteValue } func (x *_GenesisState_2_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Supplier) + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) *x.list = append(*x.list, concreteValue) } func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { - v := new(Supplier) + v := new(shared.Supplier) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } @@ -57,7 +58,7 @@ func (x *_GenesisState_2_list) Truncate(n int) { } func (x *_GenesisState_2_list) NewElement() protoreflect.Value { - v := new(Supplier) + v := new(shared.Supplier) return protoreflect.ValueOfMessage(v.ProtoReflect()) } @@ -272,7 +273,7 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) case "poktroll.supplier.GenesisState.supplierList": if x.SupplierList == nil { - x.SupplierList = []*Supplier{} + x.SupplierList = []*shared.Supplier{} } value := &_GenesisState_2_list{list: &x.SupplierList} return protoreflect.ValueOfList(value) @@ -293,7 +294,7 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.supplier.GenesisState.supplierList": - list := []*Supplier{} + list := []*shared.Supplier{} return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: if fd.IsExtension() { @@ -547,7 +548,7 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.SupplierList = append(x.SupplierList, &Supplier{}) + x.SupplierList = append(x.SupplierList, &shared.Supplier{}) if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SupplierList[len(x.SupplierList)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } @@ -607,8 +608,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"` - SupplierList []*Supplier `protobuf:"bytes,2,rep,name=supplierList,proto3" json:"supplierList,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + SupplierList []*shared.Supplier `protobuf:"bytes,2,rep,name=supplierList,proto3" json:"supplierList,omitempty"` } func (x *GenesisState) Reset() { @@ -638,7 +639,7 @@ func (x *GenesisState) GetParams() *Params { return nil } -func (x *GenesisState) GetSupplierList() []*Supplier { +func (x *GenesisState) GetSupplierList() []*shared.Supplier { if x != nil { return x.SupplierList } @@ -655,30 +656,30 @@ var file_poktroll_supplier_genesis_proto_rawDesc = []byte{ 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, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x93, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, - 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, - 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xae, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, - 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x01, + 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, + 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x43, 0x0a, 0x0c, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, + 0x74, 0x42, 0xae, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0c, 0x47, 0x65, 0x6e, + 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, + 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -695,13 +696,13 @@ func file_poktroll_supplier_genesis_proto_rawDescGZIP() []byte { var file_poktroll_supplier_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_supplier_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: poktroll.supplier.GenesisState - (*Params)(nil), // 1: poktroll.supplier.Params - (*Supplier)(nil), // 2: poktroll.supplier.Supplier + (*GenesisState)(nil), // 0: poktroll.supplier.GenesisState + (*Params)(nil), // 1: poktroll.supplier.Params + (*shared.Supplier)(nil), // 2: poktroll.shared.Supplier } var file_poktroll_supplier_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.supplier.GenesisState.params:type_name -> poktroll.supplier.Params - 2, // 1: poktroll.supplier.GenesisState.supplierList:type_name -> poktroll.supplier.Supplier + 2, // 1: poktroll.supplier.GenesisState.supplierList:type_name -> poktroll.shared.Supplier 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 @@ -715,7 +716,6 @@ func file_poktroll_supplier_genesis_proto_init() { return } file_poktroll_supplier_params_proto_init() - file_poktroll_supplier_supplier_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_supplier_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenesisState); i { diff --git a/api/poktroll/supplier/query.pulsar.go b/api/poktroll/supplier/query.pulsar.go index 2245a83bd..c66f2da6d 100644 --- a/api/poktroll/supplier/query.pulsar.go +++ b/api/poktroll/supplier/query.pulsar.go @@ -8,6 +8,7 @@ import ( fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" @@ -1385,7 +1386,7 @@ func (x *fastReflection_QueryGetSupplierResponse) Get(descriptor protoreflect.Fi func (x *fastReflection_QueryGetSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.supplier.QueryGetSupplierResponse.supplier": - x.Supplier = value.Message().Interface().(*Supplier) + x.Supplier = value.Message().Interface().(*shared.Supplier) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) @@ -1408,7 +1409,7 @@ func (x *fastReflection_QueryGetSupplierResponse) Mutable(fd protoreflect.FieldD switch fd.FullName() { case "poktroll.supplier.QueryGetSupplierResponse.supplier": if x.Supplier == nil { - x.Supplier = new(Supplier) + x.Supplier = new(shared.Supplier) } return protoreflect.ValueOfMessage(x.Supplier.ProtoReflect()) default: @@ -1425,7 +1426,7 @@ func (x *fastReflection_QueryGetSupplierResponse) Mutable(fd protoreflect.FieldD func (x *fastReflection_QueryGetSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.supplier.QueryGetSupplierResponse.supplier": - m := new(Supplier) + m := new(shared.Supplier) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { @@ -1622,7 +1623,7 @@ func (x *fastReflection_QueryGetSupplierResponse) ProtoMethods() *protoiface.Met return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } if x.Supplier == nil { - x.Supplier = &Supplier{} + x.Supplier = &shared.Supplier{} } if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Supplier); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err @@ -2101,7 +2102,7 @@ func (x *fastReflection_QueryAllSupplierRequest) ProtoMethods() *protoiface.Meth var _ protoreflect.List = (*_QueryAllSupplierResponse_1_list)(nil) type _QueryAllSupplierResponse_1_list struct { - list *[]*Supplier + list *[]*shared.Supplier } func (x *_QueryAllSupplierResponse_1_list) Len() int { @@ -2117,18 +2118,18 @@ func (x *_QueryAllSupplierResponse_1_list) Get(i int) protoreflect.Value { func (x *_QueryAllSupplierResponse_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Supplier) + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) (*x.list)[i] = concreteValue } func (x *_QueryAllSupplierResponse_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Supplier) + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) *x.list = append(*x.list, concreteValue) } func (x *_QueryAllSupplierResponse_1_list) AppendMutable() protoreflect.Value { - v := new(Supplier) + v := new(shared.Supplier) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } @@ -2141,7 +2142,7 @@ func (x *_QueryAllSupplierResponse_1_list) Truncate(n int) { } func (x *_QueryAllSupplierResponse_1_list) NewElement() protoreflect.Value { - v := new(Supplier) + v := new(shared.Supplier) return protoreflect.ValueOfMessage(v.ProtoReflect()) } @@ -2351,7 +2352,7 @@ func (x *fastReflection_QueryAllSupplierResponse) Mutable(fd protoreflect.FieldD switch fd.FullName() { case "poktroll.supplier.QueryAllSupplierResponse.supplier": if x.Supplier == nil { - x.Supplier = []*Supplier{} + x.Supplier = []*shared.Supplier{} } value := &_QueryAllSupplierResponse_1_list{list: &x.Supplier} return protoreflect.ValueOfList(value) @@ -2374,7 +2375,7 @@ func (x *fastReflection_QueryAllSupplierResponse) Mutable(fd protoreflect.FieldD func (x *fastReflection_QueryAllSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.supplier.QueryAllSupplierResponse.supplier": - list := []*Supplier{} + list := []*shared.Supplier{} return protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{list: &list}) case "poktroll.supplier.QueryAllSupplierResponse.pagination": m := new(v1beta1.PageResponse) @@ -2595,7 +2596,7 @@ func (x *fastReflection_QueryAllSupplierResponse) ProtoMethods() *protoiface.Met if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Supplier = append(x.Supplier, &Supplier{}) + x.Supplier = append(x.Supplier, &shared.Supplier{}) if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Supplier[len(x.Supplier)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } @@ -2788,7 +2789,7 @@ type QueryGetSupplierResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Supplier *Supplier `protobuf:"bytes,1,opt,name=supplier,proto3" json:"supplier,omitempty"` + Supplier *shared.Supplier `protobuf:"bytes,1,opt,name=supplier,proto3" json:"supplier,omitempty"` } func (x *QueryGetSupplierResponse) Reset() { @@ -2811,7 +2812,7 @@ func (*QueryGetSupplierResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{3} } -func (x *QueryGetSupplierResponse) GetSupplier() *Supplier { +func (x *QueryGetSupplierResponse) GetSupplier() *shared.Supplier { if x != nil { return x.Supplier } @@ -2858,7 +2859,7 @@ type QueryAllSupplierResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Supplier []*Supplier `protobuf:"bytes,1,rep,name=supplier,proto3" json:"supplier,omitempty"` + Supplier []*shared.Supplier `protobuf:"bytes,1,rep,name=supplier,proto3" json:"supplier,omitempty"` Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -2882,7 +2883,7 @@ func (*QueryAllSupplierResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryAllSupplierResponse) GetSupplier() []*Supplier { +func (x *QueryAllSupplierResponse) GetSupplier() []*shared.Supplier { if x != nil { return x.Supplier } @@ -2911,83 +2912,83 @@ var file_poktroll_supplier_query_proto_rawDesc = []byte{ 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 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, 0x53, 0x0a, - 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x22, 0x2f, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x22, 0x59, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x3d, 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x22, 0x61, - 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 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, 0xa2, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, - 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xcc, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 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, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x0a, 0x13, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, + 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x22, 0x2f, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x22, 0x57, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, + 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, + 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xcc, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x08, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0b, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x6c, 0x6c, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, - 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0xac, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, - 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, - 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0b, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x41, 0x6c, 0x6c, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, + 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, + 0xac, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3011,15 +3012,15 @@ var file_poktroll_supplier_query_proto_goTypes = []interface{}{ (*QueryAllSupplierRequest)(nil), // 4: poktroll.supplier.QueryAllSupplierRequest (*QueryAllSupplierResponse)(nil), // 5: poktroll.supplier.QueryAllSupplierResponse (*Params)(nil), // 6: poktroll.supplier.Params - (*Supplier)(nil), // 7: poktroll.supplier.Supplier + (*shared.Supplier)(nil), // 7: poktroll.shared.Supplier (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_supplier_query_proto_depIdxs = []int32{ 6, // 0: poktroll.supplier.QueryParamsResponse.params:type_name -> poktroll.supplier.Params - 7, // 1: poktroll.supplier.QueryGetSupplierResponse.supplier:type_name -> poktroll.supplier.Supplier + 7, // 1: poktroll.supplier.QueryGetSupplierResponse.supplier:type_name -> poktroll.shared.Supplier 8, // 2: poktroll.supplier.QueryAllSupplierRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.supplier.QueryAllSupplierResponse.supplier:type_name -> poktroll.supplier.Supplier + 7, // 3: poktroll.supplier.QueryAllSupplierResponse.supplier:type_name -> poktroll.shared.Supplier 9, // 4: poktroll.supplier.QueryAllSupplierResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 0, // 5: poktroll.supplier.Query.Params:input_type -> poktroll.supplier.QueryParamsRequest 2, // 6: poktroll.supplier.Query.Supplier:input_type -> poktroll.supplier.QueryGetSupplierRequest @@ -3040,7 +3041,6 @@ func file_poktroll_supplier_query_proto_init() { return } file_poktroll_supplier_params_proto_init() - file_poktroll_supplier_supplier_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_supplier_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml new file mode 100644 index 000000000..1fcae879e --- /dev/null +++ b/proto/buf.gen.pulsar.yaml @@ -0,0 +1,22 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.pulsar.yaml +# +version: v1 +managed: + enabled: true + go_package_prefix: + default: cosmossdk.io/api + except: + - buf.build/googleapis/googleapis + - buf.build/cosmos/gogo-proto + - buf.build/cosmos/cosmos-proto + override: +plugins: + - name: go-pulsar + out: ./api + opt: paths=source_relative,Mpoktroll/shared/service.proto=github.com/pokt-network/poktroll/api/poktroll/shared,Mpoktroll/shared/supplier.proto=github.com/pokt-network/poktroll/api/poktroll/shared + - name: go-grpc + out: ./api + opt: paths=source_relative diff --git a/proto/poktroll/supplier/supplier.proto b/proto/poktroll/shared/supplier.proto similarity index 72% rename from proto/poktroll/supplier/supplier.proto rename to proto/poktroll/shared/supplier.proto index f4bdf8226..122e78000 100644 --- a/proto/poktroll/supplier/supplier.proto +++ b/proto/poktroll/shared/supplier.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -package poktroll.supplier; +package poktroll.shared; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; +option go_package = "github.com/pokt-network/poktroll/x/shared/types"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; diff --git a/proto/poktroll/supplier/genesis.proto b/proto/poktroll/supplier/genesis.proto index 1ae2bd210..5970cc005 100644 --- a/proto/poktroll/supplier/genesis.proto +++ b/proto/poktroll/supplier/genesis.proto @@ -5,15 +5,15 @@ package poktroll.supplier; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "poktroll/supplier/params.proto"; -import "poktroll/supplier/supplier.proto"; +import "poktroll/shared/supplier.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; // GenesisState defines the supplier 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 Supplier supplierList = 2 [(gogoproto.nullable) = false] ; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated poktroll.shared.Supplier supplierList = 2 [(gogoproto.nullable) = false] ; } diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto index a43fd9a68..0f1b27663 100644 --- a/proto/poktroll/supplier/query.proto +++ b/proto/poktroll/supplier/query.proto @@ -7,7 +7,7 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "poktroll/supplier/params.proto"; -import "poktroll/supplier/supplier.proto"; +import "poktroll/shared/supplier.proto"; import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; @@ -46,7 +46,7 @@ message QueryGetSupplierRequest { } message QueryGetSupplierResponse { - Supplier supplier = 1 [(gogoproto.nullable) = false]; + poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; } message QueryAllSupplierRequest { @@ -54,7 +54,7 @@ message QueryAllSupplierRequest { } message QueryAllSupplierResponse { - repeated Supplier supplier = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go index 598b719f5..33bdb0b0e 100644 --- a/x/supplier/keeper/query_supplier.go +++ b/x/supplier/keeper/query_supplier.go @@ -6,9 +6,11 @@ import ( "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/pokt-network/poktroll/x/supplier/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" ) func (k Keeper) SupplierAll(ctx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { @@ -16,13 +18,13 @@ func (k Keeper) SupplierAll(ctx context.Context, req *types.QueryAllSupplierRequ return nil, status.Error(codes.InvalidArgument, "invalid request") } - var suppliers []types.Supplier + var suppliers []sharedtypes.Supplier store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { - var supplier types.Supplier + var supplier sharedtypes.Supplier if err := k.cdc.Unmarshal(value, &supplier); err != nil { return err } From 0541b669167aa617a919c4134a61ef5afc97ffd1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 8 Feb 2024 14:17:58 +0100 Subject: [PATCH 04/23] reconcile: `SupplierServiceConfig` & dep proto types --- api/poktroll/shared/service.pulsar.go | 2615 +++++++++++++++++++++++++ proto/poktroll/shared/service.proto | 57 + 2 files changed, 2672 insertions(+) create mode 100644 api/poktroll/shared/service.pulsar.go create mode 100644 proto/poktroll/shared/service.proto diff --git a/api/poktroll/shared/service.pulsar.go b/api/poktroll/shared/service.pulsar.go new file mode 100644 index 000000000..612601e86 --- /dev/null +++ b/api/poktroll/shared/service.pulsar.go @@ -0,0 +1,2615 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package shared + +import ( + 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_Service protoreflect.MessageDescriptor + fd_Service_id protoreflect.FieldDescriptor + fd_Service_name protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_Service = File_poktroll_shared_service_proto.Messages().ByName("Service") + fd_Service_id = md_Service.Fields().ByName("id") + fd_Service_name = md_Service.Fields().ByName("name") +} + +var _ protoreflect.Message = (*fastReflection_Service)(nil) + +type fastReflection_Service Service + +func (x *Service) ProtoReflect() protoreflect.Message { + return (*fastReflection_Service)(x) +} + +func (x *Service) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_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_Service_messageType fastReflection_Service_messageType +var _ protoreflect.MessageType = fastReflection_Service_messageType{} + +type fastReflection_Service_messageType struct{} + +func (x fastReflection_Service_messageType) Zero() protoreflect.Message { + return (*fastReflection_Service)(nil) +} +func (x fastReflection_Service_messageType) New() protoreflect.Message { + return new(fastReflection_Service) +} +func (x fastReflection_Service_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Service) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// 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_Service) Type() protoreflect.MessageType { + return _fastReflection_Service_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Service) New() protoreflect.Message { + return new(fastReflection_Service) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Service) Interface() protoreflect.ProtoMessage { + return (*Service)(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_Service) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_Service_id, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_Service_name, 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_Service) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.Service.id": + return x.Id != "" + case "poktroll.shared.Service.name": + return x.Name != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service 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_Service) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.Service.id": + x.Id = "" + case "poktroll.shared.Service.name": + x.Name = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service 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_Service) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.Service.id": + value := x.Id + return protoreflect.ValueOfString(value) + case "poktroll.shared.Service.name": + value := x.Name + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service 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_Service) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.Service.id": + x.Id = value.Interface().(string) + case "poktroll.shared.Service.name": + x.Name = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service 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_Service) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Service.id": + panic(fmt.Errorf("field id of message poktroll.shared.Service is not mutable")) + case "poktroll.shared.Service.name": + panic(fmt.Errorf("field name of message poktroll.shared.Service is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service 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_Service) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Service.id": + return protoreflect.ValueOfString("") + case "poktroll.shared.Service.name": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service 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_Service) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.Service", 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_Service) 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_Service) 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_Service) 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_Service) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Service) + 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.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + 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().(*Service) + 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.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + 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().(*Service) + 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: Service: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: 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 Id", 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 = (*_SupplierServiceConfig_2_list)(nil) + +type _SupplierServiceConfig_2_list struct { + list *[]*SupplierEndpoint +} + +func (x *_SupplierServiceConfig_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_SupplierServiceConfig_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_SupplierServiceConfig_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierEndpoint) + (*x.list)[i] = concreteValue +} + +func (x *_SupplierServiceConfig_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierEndpoint) + *x.list = append(*x.list, concreteValue) +} + +func (x *_SupplierServiceConfig_2_list) AppendMutable() protoreflect.Value { + v := new(SupplierEndpoint) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierServiceConfig_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_SupplierServiceConfig_2_list) NewElement() protoreflect.Value { + v := new(SupplierEndpoint) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierServiceConfig_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_SupplierServiceConfig protoreflect.MessageDescriptor + fd_SupplierServiceConfig_service protoreflect.FieldDescriptor + fd_SupplierServiceConfig_endpoints protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_SupplierServiceConfig = File_poktroll_shared_service_proto.Messages().ByName("SupplierServiceConfig") + fd_SupplierServiceConfig_service = md_SupplierServiceConfig.Fields().ByName("service") + fd_SupplierServiceConfig_endpoints = md_SupplierServiceConfig.Fields().ByName("endpoints") +} + +var _ protoreflect.Message = (*fastReflection_SupplierServiceConfig)(nil) + +type fastReflection_SupplierServiceConfig SupplierServiceConfig + +func (x *SupplierServiceConfig) ProtoReflect() protoreflect.Message { + return (*fastReflection_SupplierServiceConfig)(x) +} + +func (x *SupplierServiceConfig) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_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_SupplierServiceConfig_messageType fastReflection_SupplierServiceConfig_messageType +var _ protoreflect.MessageType = fastReflection_SupplierServiceConfig_messageType{} + +type fastReflection_SupplierServiceConfig_messageType struct{} + +func (x fastReflection_SupplierServiceConfig_messageType) Zero() protoreflect.Message { + return (*fastReflection_SupplierServiceConfig)(nil) +} +func (x fastReflection_SupplierServiceConfig_messageType) New() protoreflect.Message { + return new(fastReflection_SupplierServiceConfig) +} +func (x fastReflection_SupplierServiceConfig_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierServiceConfig +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_SupplierServiceConfig) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierServiceConfig +} + +// 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_SupplierServiceConfig) Type() protoreflect.MessageType { + return _fastReflection_SupplierServiceConfig_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_SupplierServiceConfig) New() protoreflect.Message { + return new(fastReflection_SupplierServiceConfig) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_SupplierServiceConfig) Interface() protoreflect.ProtoMessage { + return (*SupplierServiceConfig)(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_SupplierServiceConfig) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_SupplierServiceConfig_service, value) { + return + } + } + if len(x.Endpoints) != 0 { + value := protoreflect.ValueOfList(&_SupplierServiceConfig_2_list{list: &x.Endpoints}) + if !f(fd_SupplierServiceConfig_endpoints, 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_SupplierServiceConfig) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + return x.Service != nil + case "poktroll.shared.SupplierServiceConfig.endpoints": + return len(x.Endpoints) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig 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_SupplierServiceConfig) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + x.Service = nil + case "poktroll.shared.SupplierServiceConfig.endpoints": + x.Endpoints = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig 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_SupplierServiceConfig) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.shared.SupplierServiceConfig.endpoints": + if len(x.Endpoints) == 0 { + return protoreflect.ValueOfList(&_SupplierServiceConfig_2_list{}) + } + listValue := &_SupplierServiceConfig_2_list{list: &x.Endpoints} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig 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_SupplierServiceConfig) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + x.Service = value.Message().Interface().(*Service) + case "poktroll.shared.SupplierServiceConfig.endpoints": + lv := value.List() + clv := lv.(*_SupplierServiceConfig_2_list) + x.Endpoints = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig 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_SupplierServiceConfig) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + if x.Service == nil { + x.Service = new(Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + case "poktroll.shared.SupplierServiceConfig.endpoints": + if x.Endpoints == nil { + x.Endpoints = []*SupplierEndpoint{} + } + value := &_SupplierServiceConfig_2_list{list: &x.Endpoints} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig 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_SupplierServiceConfig) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + m := new(Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.shared.SupplierServiceConfig.endpoints": + list := []*SupplierEndpoint{} + return protoreflect.ValueOfList(&_SupplierServiceConfig_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig 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_SupplierServiceConfig) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.SupplierServiceConfig", 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_SupplierServiceConfig) 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_SupplierServiceConfig) 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_SupplierServiceConfig) 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_SupplierServiceConfig) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*SupplierServiceConfig) + 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.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Endpoints) > 0 { + for _, e := range x.Endpoints { + l = options.Size(e) + 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().(*SupplierServiceConfig) + 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.Endpoints) > 0 { + for iNdEx := len(x.Endpoints) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Endpoints[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.Service != nil { + encoded, err := options.Marshal(x.Service) + 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().(*SupplierServiceConfig) + 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: SupplierServiceConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SupplierServiceConfig: 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 Service", 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.Service == nil { + x.Service = &Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); 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 Endpoints", 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.Endpoints = append(x.Endpoints, &SupplierEndpoint{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Endpoints[len(x.Endpoints)-1]); 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 = (*_SupplierEndpoint_3_list)(nil) + +type _SupplierEndpoint_3_list struct { + list *[]*ConfigOption +} + +func (x *_SupplierEndpoint_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_SupplierEndpoint_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_SupplierEndpoint_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*ConfigOption) + (*x.list)[i] = concreteValue +} + +func (x *_SupplierEndpoint_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*ConfigOption) + *x.list = append(*x.list, concreteValue) +} + +func (x *_SupplierEndpoint_3_list) AppendMutable() protoreflect.Value { + v := new(ConfigOption) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierEndpoint_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_SupplierEndpoint_3_list) NewElement() protoreflect.Value { + v := new(ConfigOption) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierEndpoint_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_SupplierEndpoint protoreflect.MessageDescriptor + fd_SupplierEndpoint_url protoreflect.FieldDescriptor + fd_SupplierEndpoint_rpc_type protoreflect.FieldDescriptor + fd_SupplierEndpoint_configs protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_SupplierEndpoint = File_poktroll_shared_service_proto.Messages().ByName("SupplierEndpoint") + fd_SupplierEndpoint_url = md_SupplierEndpoint.Fields().ByName("url") + fd_SupplierEndpoint_rpc_type = md_SupplierEndpoint.Fields().ByName("rpc_type") + fd_SupplierEndpoint_configs = md_SupplierEndpoint.Fields().ByName("configs") +} + +var _ protoreflect.Message = (*fastReflection_SupplierEndpoint)(nil) + +type fastReflection_SupplierEndpoint SupplierEndpoint + +func (x *SupplierEndpoint) ProtoReflect() protoreflect.Message { + return (*fastReflection_SupplierEndpoint)(x) +} + +func (x *SupplierEndpoint) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_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_SupplierEndpoint_messageType fastReflection_SupplierEndpoint_messageType +var _ protoreflect.MessageType = fastReflection_SupplierEndpoint_messageType{} + +type fastReflection_SupplierEndpoint_messageType struct{} + +func (x fastReflection_SupplierEndpoint_messageType) Zero() protoreflect.Message { + return (*fastReflection_SupplierEndpoint)(nil) +} +func (x fastReflection_SupplierEndpoint_messageType) New() protoreflect.Message { + return new(fastReflection_SupplierEndpoint) +} +func (x fastReflection_SupplierEndpoint_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierEndpoint +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_SupplierEndpoint) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierEndpoint +} + +// 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_SupplierEndpoint) Type() protoreflect.MessageType { + return _fastReflection_SupplierEndpoint_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_SupplierEndpoint) New() protoreflect.Message { + return new(fastReflection_SupplierEndpoint) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_SupplierEndpoint) Interface() protoreflect.ProtoMessage { + return (*SupplierEndpoint)(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_SupplierEndpoint) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Url != "" { + value := protoreflect.ValueOfString(x.Url) + if !f(fd_SupplierEndpoint_url, value) { + return + } + } + if x.RpcType != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.RpcType)) + if !f(fd_SupplierEndpoint_rpc_type, value) { + return + } + } + if len(x.Configs) != 0 { + value := protoreflect.ValueOfList(&_SupplierEndpoint_3_list{list: &x.Configs}) + if !f(fd_SupplierEndpoint_configs, 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_SupplierEndpoint) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + return x.Url != "" + case "poktroll.shared.SupplierEndpoint.rpc_type": + return x.RpcType != 0 + case "poktroll.shared.SupplierEndpoint.configs": + return len(x.Configs) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint 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_SupplierEndpoint) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + x.Url = "" + case "poktroll.shared.SupplierEndpoint.rpc_type": + x.RpcType = 0 + case "poktroll.shared.SupplierEndpoint.configs": + x.Configs = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint 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_SupplierEndpoint) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + value := x.Url + return protoreflect.ValueOfString(value) + case "poktroll.shared.SupplierEndpoint.rpc_type": + value := x.RpcType + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "poktroll.shared.SupplierEndpoint.configs": + if len(x.Configs) == 0 { + return protoreflect.ValueOfList(&_SupplierEndpoint_3_list{}) + } + listValue := &_SupplierEndpoint_3_list{list: &x.Configs} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint 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_SupplierEndpoint) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + x.Url = value.Interface().(string) + case "poktroll.shared.SupplierEndpoint.rpc_type": + x.RpcType = (RPCType)(value.Enum()) + case "poktroll.shared.SupplierEndpoint.configs": + lv := value.List() + clv := lv.(*_SupplierEndpoint_3_list) + x.Configs = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint 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_SupplierEndpoint) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.configs": + if x.Configs == nil { + x.Configs = []*ConfigOption{} + } + value := &_SupplierEndpoint_3_list{list: &x.Configs} + return protoreflect.ValueOfList(value) + case "poktroll.shared.SupplierEndpoint.url": + panic(fmt.Errorf("field url of message poktroll.shared.SupplierEndpoint is not mutable")) + case "poktroll.shared.SupplierEndpoint.rpc_type": + panic(fmt.Errorf("field rpc_type of message poktroll.shared.SupplierEndpoint is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint 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_SupplierEndpoint) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + return protoreflect.ValueOfString("") + case "poktroll.shared.SupplierEndpoint.rpc_type": + return protoreflect.ValueOfEnum(0) + case "poktroll.shared.SupplierEndpoint.configs": + list := []*ConfigOption{} + return protoreflect.ValueOfList(&_SupplierEndpoint_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint 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_SupplierEndpoint) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.SupplierEndpoint", 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_SupplierEndpoint) 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_SupplierEndpoint) 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_SupplierEndpoint) 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_SupplierEndpoint) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*SupplierEndpoint) + 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.Url) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.RpcType != 0 { + n += 1 + runtime.Sov(uint64(x.RpcType)) + } + if len(x.Configs) > 0 { + for _, e := range x.Configs { + l = options.Size(e) + 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().(*SupplierEndpoint) + 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.Configs) > 0 { + for iNdEx := len(x.Configs) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Configs[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] = 0x1a + } + } + if x.RpcType != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RpcType)) + i-- + dAtA[i] = 0x10 + } + if len(x.Url) > 0 { + i -= len(x.Url) + copy(dAtA[i:], x.Url) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Url))) + 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().(*SupplierEndpoint) + 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: SupplierEndpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SupplierEndpoint: 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 Url", 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.Url = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RpcType", wireType) + } + x.RpcType = 0 + 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++ + x.RpcType |= RPCType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Configs", 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.Configs = append(x.Configs, &ConfigOption{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Configs[len(x.Configs)-1]); 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_ConfigOption protoreflect.MessageDescriptor + fd_ConfigOption_key protoreflect.FieldDescriptor + fd_ConfigOption_value protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_ConfigOption = File_poktroll_shared_service_proto.Messages().ByName("ConfigOption") + fd_ConfigOption_key = md_ConfigOption.Fields().ByName("key") + fd_ConfigOption_value = md_ConfigOption.Fields().ByName("value") +} + +var _ protoreflect.Message = (*fastReflection_ConfigOption)(nil) + +type fastReflection_ConfigOption ConfigOption + +func (x *ConfigOption) ProtoReflect() protoreflect.Message { + return (*fastReflection_ConfigOption)(x) +} + +func (x *ConfigOption) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_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_ConfigOption_messageType fastReflection_ConfigOption_messageType +var _ protoreflect.MessageType = fastReflection_ConfigOption_messageType{} + +type fastReflection_ConfigOption_messageType struct{} + +func (x fastReflection_ConfigOption_messageType) Zero() protoreflect.Message { + return (*fastReflection_ConfigOption)(nil) +} +func (x fastReflection_ConfigOption_messageType) New() protoreflect.Message { + return new(fastReflection_ConfigOption) +} +func (x fastReflection_ConfigOption_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ConfigOption +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_ConfigOption) Descriptor() protoreflect.MessageDescriptor { + return md_ConfigOption +} + +// 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_ConfigOption) Type() protoreflect.MessageType { + return _fastReflection_ConfigOption_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_ConfigOption) New() protoreflect.Message { + return new(fastReflection_ConfigOption) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_ConfigOption) Interface() protoreflect.ProtoMessage { + return (*ConfigOption)(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_ConfigOption) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Key != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Key)) + if !f(fd_ConfigOption_key, value) { + return + } + } + if x.Value != "" { + value := protoreflect.ValueOfString(x.Value) + if !f(fd_ConfigOption_value, 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_ConfigOption) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + return x.Key != 0 + case "poktroll.shared.ConfigOption.value": + return x.Value != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption 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_ConfigOption) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + x.Key = 0 + case "poktroll.shared.ConfigOption.value": + x.Value = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption 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_ConfigOption) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.ConfigOption.key": + value := x.Key + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "poktroll.shared.ConfigOption.value": + value := x.Value + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption 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_ConfigOption) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + x.Key = (ConfigOptions)(value.Enum()) + case "poktroll.shared.ConfigOption.value": + x.Value = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption 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_ConfigOption) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + panic(fmt.Errorf("field key of message poktroll.shared.ConfigOption is not mutable")) + case "poktroll.shared.ConfigOption.value": + panic(fmt.Errorf("field value of message poktroll.shared.ConfigOption is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption 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_ConfigOption) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + return protoreflect.ValueOfEnum(0) + case "poktroll.shared.ConfigOption.value": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption 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_ConfigOption) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.ConfigOption", 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_ConfigOption) 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_ConfigOption) 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_ConfigOption) 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_ConfigOption) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*ConfigOption) + 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.Key != 0 { + n += 1 + runtime.Sov(uint64(x.Key)) + } + l = len(x.Value) + 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().(*ConfigOption) + 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.Value) > 0 { + i -= len(x.Value) + copy(dAtA[i:], x.Value) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Value))) + i-- + dAtA[i] = 0x12 + } + if x.Key != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Key)) + i-- + dAtA[i] = 0x8 + } + 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().(*ConfigOption) + 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: ConfigOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + x.Key = 0 + 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++ + x.Key |= ConfigOptions(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value = 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/shared/service.proto + +// NOTE that the `shared` package is not a Cosmos module, +// but rather a manually created package to resolve circular dependencies. + +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) +) + +// Enum to define RPC types +type RPCType int32 + +const ( + RPCType_UNKNOWN_RPC RPCType = 0 // Undefined RPC type + RPCType_GRPC RPCType = 1 // gRPC + RPCType_WEBSOCKET RPCType = 2 // WebSocket + RPCType_JSON_RPC RPCType = 3 // JSON-RPC + RPCType_REST RPCType = 4 // REST +) + +// Enum value maps for RPCType. +var ( + RPCType_name = map[int32]string{ + 0: "UNKNOWN_RPC", + 1: "GRPC", + 2: "WEBSOCKET", + 3: "JSON_RPC", + 4: "REST", + } + RPCType_value = map[string]int32{ + "UNKNOWN_RPC": 0, + "GRPC": 1, + "WEBSOCKET": 2, + "JSON_RPC": 3, + "REST": 4, + } +) + +func (x RPCType) Enum() *RPCType { + p := new(RPCType) + *p = x + return p +} + +func (x RPCType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RPCType) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_shared_service_proto_enumTypes[0].Descriptor() +} + +func (RPCType) Type() protoreflect.EnumType { + return &file_poktroll_shared_service_proto_enumTypes[0] +} + +func (x RPCType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RPCType.Descriptor instead. +func (RPCType) EnumDescriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{0} +} + +// Enum to define configuration options +// TODO_RESEARCH: Should these be configs, SLAs or something else? There will be more discussion once we get closer to implementing on-chain QoS. +type ConfigOptions int32 + +const ( + ConfigOptions_UNKNOWN_CONFIG ConfigOptions = 0 // Undefined config option + ConfigOptions_TIMEOUT ConfigOptions = 1 // Timeout setting +) + +// Enum value maps for ConfigOptions. +var ( + ConfigOptions_name = map[int32]string{ + 0: "UNKNOWN_CONFIG", + 1: "TIMEOUT", + } + ConfigOptions_value = map[string]int32{ + "UNKNOWN_CONFIG": 0, + "TIMEOUT": 1, + } +) + +func (x ConfigOptions) Enum() *ConfigOptions { + p := new(ConfigOptions) + *p = x + return p +} + +func (x ConfigOptions) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfigOptions) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_shared_service_proto_enumTypes[1].Descriptor() +} + +func (ConfigOptions) Type() protoreflect.EnumType { + return &file_poktroll_shared_service_proto_enumTypes[1] +} + +func (x ConfigOptions) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfigOptions.Descriptor instead. +func (ConfigOptions) EnumDescriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{1} +} + +// Service message to encapsulate unique and semantic identifiers for a service on the network +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // For example, what if we want to request a session for a certain service but with some additional configs that identify it? + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the service + // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // (Optional) Semantic human readable name for the service +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +// Deprecated: Use Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Service) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// SupplierServiceConfig holds the service configuration the supplier stakes for +type SupplierServiceConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the supplier is configured + Endpoints []*SupplierEndpoint `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"` // List of endpoints for the service +} + +func (x *SupplierServiceConfig) Reset() { + *x = SupplierServiceConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupplierServiceConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupplierServiceConfig) ProtoMessage() {} + +// Deprecated: Use SupplierServiceConfig.ProtoReflect.Descriptor instead. +func (*SupplierServiceConfig) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{1} +} + +func (x *SupplierServiceConfig) GetService() *Service { + if x != nil { + return x.Service + } + return nil +} + +func (x *SupplierServiceConfig) GetEndpoints() []*SupplierEndpoint { + if x != nil { + return x.Endpoints + } + return nil +} + +// SupplierEndpoint message to hold service configuration details +type SupplierEndpoint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // URL of the endpoint + RpcType RPCType `protobuf:"varint,2,opt,name=rpc_type,json=rpcType,proto3,enum=poktroll.shared.RPCType" json:"rpc_type,omitempty"` // Type of RPC exposed on the url above + Configs []*ConfigOption `protobuf:"bytes,3,rep,name=configs,proto3" json:"configs,omitempty"` // Additional configuration options for the endpoint +} + +func (x *SupplierEndpoint) Reset() { + *x = SupplierEndpoint{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupplierEndpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupplierEndpoint) ProtoMessage() {} + +// Deprecated: Use SupplierEndpoint.ProtoReflect.Descriptor instead. +func (*SupplierEndpoint) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{2} +} + +func (x *SupplierEndpoint) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *SupplierEndpoint) GetRpcType() RPCType { + if x != nil { + return x.RpcType + } + return RPCType_UNKNOWN_RPC +} + +func (x *SupplierEndpoint) GetConfigs() []*ConfigOption { + if x != nil { + return x.Configs + } + return nil +} + +// Key-value wrapper for config options, as proto maps can't be keyed by enums +type ConfigOption struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key ConfigOptions `protobuf:"varint,1,opt,name=key,proto3,enum=poktroll.shared.ConfigOptions" json:"key,omitempty"` // Config option key + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // Config option value +} + +func (x *ConfigOption) Reset() { + *x = ConfigOption{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigOption) ProtoMessage() {} + +// Deprecated: Use ConfigOption.ProtoReflect.Descriptor instead. +func (*ConfigOption) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ConfigOption) GetKey() ConfigOptions { + if x != nil { + return x.Key + } + return ConfigOptions_UNKNOWN_CONFIG +} + +func (x *ConfigOption) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +var File_poktroll_shared_service_proto protoreflect.FileDescriptor + +var file_poktroll_shared_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x22, 0x2d, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x8c, 0x01, 0x0a, 0x15, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x32, 0x0a, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, + 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x92, + 0x01, 0x0a, 0x10, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x33, 0x0a, 0x08, 0x72, 0x70, 0x63, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x07, 0x72, 0x70, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x22, 0x56, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x4b, 0x0a, 0x07, 0x52, + 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x5f, 0x52, 0x50, 0x43, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x10, + 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x02, + 0x12, 0x0c, 0x0a, 0x08, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x52, 0x50, 0x43, 0x10, 0x03, 0x12, 0x08, + 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x10, 0x04, 0x2a, 0x30, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x01, 0x42, 0xa2, 0x01, 0x0a, 0x13, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, + 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_shared_service_proto_rawDescOnce sync.Once + file_poktroll_shared_service_proto_rawDescData = file_poktroll_shared_service_proto_rawDesc +) + +func file_poktroll_shared_service_proto_rawDescGZIP() []byte { + file_poktroll_shared_service_proto_rawDescOnce.Do(func() { + file_poktroll_shared_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_shared_service_proto_rawDescData) + }) + return file_poktroll_shared_service_proto_rawDescData +} + +var file_poktroll_shared_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_poktroll_shared_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_shared_service_proto_goTypes = []interface{}{ + (RPCType)(0), // 0: poktroll.shared.RPCType + (ConfigOptions)(0), // 1: poktroll.shared.ConfigOptions + (*Service)(nil), // 2: poktroll.shared.Service + (*SupplierServiceConfig)(nil), // 3: poktroll.shared.SupplierServiceConfig + (*SupplierEndpoint)(nil), // 4: poktroll.shared.SupplierEndpoint + (*ConfigOption)(nil), // 5: poktroll.shared.ConfigOption +} +var file_poktroll_shared_service_proto_depIdxs = []int32{ + 2, // 0: poktroll.shared.SupplierServiceConfig.service:type_name -> poktroll.shared.Service + 4, // 1: poktroll.shared.SupplierServiceConfig.endpoints:type_name -> poktroll.shared.SupplierEndpoint + 0, // 2: poktroll.shared.SupplierEndpoint.rpc_type:type_name -> poktroll.shared.RPCType + 5, // 3: poktroll.shared.SupplierEndpoint.configs:type_name -> poktroll.shared.ConfigOption + 1, // 4: poktroll.shared.ConfigOption.key:type_name -> poktroll.shared.ConfigOptions + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] 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_shared_service_proto_init() } +func file_poktroll_shared_service_proto_init() { + if File_poktroll_shared_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_shared_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupplierServiceConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupplierEndpoint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigOption); 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_shared_service_proto_rawDesc, + NumEnums: 2, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_shared_service_proto_goTypes, + DependencyIndexes: file_poktroll_shared_service_proto_depIdxs, + EnumInfos: file_poktroll_shared_service_proto_enumTypes, + MessageInfos: file_poktroll_shared_service_proto_msgTypes, + }.Build() + File_poktroll_shared_service_proto = out.File + file_poktroll_shared_service_proto_rawDesc = nil + file_poktroll_shared_service_proto_goTypes = nil + file_poktroll_shared_service_proto_depIdxs = nil +} diff --git a/proto/poktroll/shared/service.proto b/proto/poktroll/shared/service.proto new file mode 100644 index 000000000..addc397e4 --- /dev/null +++ b/proto/poktroll/shared/service.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; + +// NOTE that the `shared` package is not a Cosmos module, +// but rather a manually created package to resolve circular dependencies. +package poktroll.shared; + +option go_package = "github.com/pokt-network/poktroll/x/shared/types"; + +// TODO_CLEANUP(@Olshansk): Add native optional identifiers once its supported; https://github.com/ignite/cli/issues/3698 + +// Service message to encapsulate unique and semantic identifiers for a service on the network +message Service { + // For example, what if we want to request a session for a certain service but with some additional configs that identify it? + string id = 1; // Unique identifier for the service + + // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary + string name = 2; // (Optional) Semantic human readable name for the service +} + +// SupplierServiceConfig holds the service configuration the supplier stakes for +message SupplierServiceConfig { + Service service = 1; // The Service for which the supplier is configured + repeated SupplierEndpoint endpoints = 2; // List of endpoints for the service + // TODO_RESEARCH: There is an opportunity for supplier to advertise the min + // they're willing to earn for a certain configuration/price, but this is outside of scope. +} + +// SupplierEndpoint message to hold service configuration details +message SupplierEndpoint { + string url = 1; // URL of the endpoint + RPCType rpc_type = 2; // Type of RPC exposed on the url above + repeated ConfigOption configs = 3; // Additional configuration options for the endpoint +} + +// Enum to define RPC types +enum RPCType { + UNKNOWN_RPC = 0; // Undefined RPC type + GRPC = 1; // gRPC + WEBSOCKET = 2; // WebSocket + JSON_RPC = 3; // JSON-RPC + REST = 4; // REST + // Add new RPC types here as needed +} + +// Enum to define configuration options +// TODO_RESEARCH: Should these be configs, SLAs or something else? There will be more discussion once we get closer to implementing on-chain QoS. +enum ConfigOptions { + UNKNOWN_CONFIG = 0; // Undefined config option + TIMEOUT = 1; // Timeout setting + // Add new config options here as needed +} + +// Key-value wrapper for config options, as proto maps can't be keyed by enums +message ConfigOption { + ConfigOptions key = 1; // Config option key + string value = 2; // Config option value +} From 1d684ad95e6e899eb6e2f9212b22bf31dbec9579 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 8 Feb 2024 15:07:12 +0100 Subject: [PATCH 05/23] reconcile: `Suppler` proto type --- api/poktroll/shared/supplier.pulsar.go | 257 +++++++++++++------------ proto/poktroll/shared/supplier.proto | 15 +- 2 files changed, 143 insertions(+), 129 deletions(-) diff --git a/api/poktroll/shared/supplier.pulsar.go b/api/poktroll/shared/supplier.pulsar.go index ee0b7abd4..a0e0c637e 100644 --- a/api/poktroll/shared/supplier.pulsar.go +++ b/api/poktroll/shared/supplier.pulsar.go @@ -4,6 +4,7 @@ package shared 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" @@ -14,9 +15,59 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_Supplier_3_list)(nil) + +type _Supplier_3_list struct { + list *[]*SupplierServiceConfig +} + +func (x *_Supplier_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Supplier_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Supplier_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierServiceConfig) + (*x.list)[i] = concreteValue +} + +func (x *_Supplier_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierServiceConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Supplier_3_list) AppendMutable() protoreflect.Value { + v := new(SupplierServiceConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Supplier_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Supplier_3_list) NewElement() protoreflect.Value { + v := new(SupplierServiceConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Supplier_3_list) IsValid() bool { + return x.list != nil +} + var ( md_Supplier protoreflect.MessageDescriptor - fd_Supplier_index protoreflect.FieldDescriptor fd_Supplier_address protoreflect.FieldDescriptor fd_Supplier_stake protoreflect.FieldDescriptor fd_Supplier_services protoreflect.FieldDescriptor @@ -25,7 +76,6 @@ var ( func init() { file_poktroll_shared_supplier_proto_init() md_Supplier = File_poktroll_shared_supplier_proto.Messages().ByName("Supplier") - fd_Supplier_index = md_Supplier.Fields().ByName("index") fd_Supplier_address = md_Supplier.Fields().ByName("address") fd_Supplier_stake = md_Supplier.Fields().ByName("stake") fd_Supplier_services = md_Supplier.Fields().ByName("services") @@ -96,12 +146,6 @@ func (x *fastReflection_Supplier) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Supplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Index != "" { - value := protoreflect.ValueOfString(x.Index) - if !f(fd_Supplier_index, value) { - return - } - } if x.Address != "" { value := protoreflect.ValueOfString(x.Address) if !f(fd_Supplier_address, value) { @@ -114,8 +158,8 @@ func (x *fastReflection_Supplier) Range(f func(protoreflect.FieldDescriptor, pro return } } - if x.Services != "" { - value := protoreflect.ValueOfString(x.Services) + if len(x.Services) != 0 { + value := protoreflect.ValueOfList(&_Supplier_3_list{list: &x.Services}) if !f(fd_Supplier_services, value) { return } @@ -135,14 +179,12 @@ func (x *fastReflection_Supplier) Range(f func(protoreflect.FieldDescriptor, pro // a repeated field is populated if it is non-empty. func (x *fastReflection_Supplier) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.shared.Supplier.index": - return x.Index != "" case "poktroll.shared.Supplier.address": return x.Address != "" case "poktroll.shared.Supplier.stake": return x.Stake != nil case "poktroll.shared.Supplier.services": - return x.Services != "" + return len(x.Services) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) @@ -159,14 +201,12 @@ func (x *fastReflection_Supplier) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Supplier) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.shared.Supplier.index": - x.Index = "" case "poktroll.shared.Supplier.address": x.Address = "" case "poktroll.shared.Supplier.stake": x.Stake = nil case "poktroll.shared.Supplier.services": - x.Services = "" + x.Services = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) @@ -183,9 +223,6 @@ func (x *fastReflection_Supplier) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Supplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.shared.Supplier.index": - value := x.Index - return protoreflect.ValueOfString(value) case "poktroll.shared.Supplier.address": value := x.Address return protoreflect.ValueOfString(value) @@ -193,8 +230,11 @@ func (x *fastReflection_Supplier) Get(descriptor protoreflect.FieldDescriptor) p value := x.Stake return protoreflect.ValueOfMessage(value.ProtoReflect()) case "poktroll.shared.Supplier.services": - value := x.Services - return protoreflect.ValueOfString(value) + if len(x.Services) == 0 { + return protoreflect.ValueOfList(&_Supplier_3_list{}) + } + listValue := &_Supplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) @@ -215,14 +255,14 @@ func (x *fastReflection_Supplier) Get(descriptor protoreflect.FieldDescriptor) p // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Supplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.shared.Supplier.index": - x.Index = value.Interface().(string) case "poktroll.shared.Supplier.address": x.Address = value.Interface().(string) case "poktroll.shared.Supplier.stake": x.Stake = value.Message().Interface().(*v1beta1.Coin) case "poktroll.shared.Supplier.services": - x.Services = value.Interface().(string) + lv := value.List() + clv := lv.(*_Supplier_3_list) + x.Services = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) @@ -248,12 +288,14 @@ func (x *fastReflection_Supplier) Mutable(fd protoreflect.FieldDescriptor) proto x.Stake = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) - case "poktroll.shared.Supplier.index": - panic(fmt.Errorf("field index of message poktroll.shared.Supplier is not mutable")) + case "poktroll.shared.Supplier.services": + if x.Services == nil { + x.Services = []*SupplierServiceConfig{} + } + value := &_Supplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(value) case "poktroll.shared.Supplier.address": panic(fmt.Errorf("field address of message poktroll.shared.Supplier is not mutable")) - case "poktroll.shared.Supplier.services": - panic(fmt.Errorf("field services of message poktroll.shared.Supplier is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) @@ -267,15 +309,14 @@ func (x *fastReflection_Supplier) Mutable(fd protoreflect.FieldDescriptor) proto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Supplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.shared.Supplier.index": - return protoreflect.ValueOfString("") case "poktroll.shared.Supplier.address": return protoreflect.ValueOfString("") case "poktroll.shared.Supplier.stake": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.shared.Supplier.services": - return protoreflect.ValueOfString("") + list := []*SupplierServiceConfig{} + return protoreflect.ValueOfList(&_Supplier_3_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) @@ -345,10 +386,6 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Index) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } l = len(x.Address) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -357,9 +394,11 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { l = options.Size(x.Stake) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Services) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.Services) > 0 { + for _, e := range x.Services { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -391,11 +430,20 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } if len(x.Services) > 0 { - i -= len(x.Services) - copy(dAtA[i:], x.Services) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Services))) - i-- - dAtA[i] = 0x22 + for iNdEx := len(x.Services) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Services[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] = 0x1a + } } if x.Stake != nil { encoded, err := options.Marshal(x.Stake) @@ -409,20 +457,13 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x1a + 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] = 0x12 - } - if len(x.Index) > 0 { - i -= len(x.Index) - copy(dAtA[i:], x.Index) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) - i-- dAtA[i] = 0xa } if input.Buf != nil { @@ -475,38 +516,6 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", 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.Index = 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 Address", wireType) } @@ -538,7 +547,7 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { } x.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) } @@ -574,11 +583,11 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -588,23 +597,25 @@ func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Services = string(dAtA[iNdEx:postIndex]) + x.Services = append(x.Services, &SupplierServiceConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Services[len(x.Services)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex default: iNdEx = preIndex @@ -654,15 +665,15 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Supplier is the type defining the actor in Pocket Network that provides RPC services. type Supplier struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Stake *v1beta1.Coin `protobuf:"bytes,3,opt,name=stake,proto3" json:"stake,omitempty"` - Services string `protobuf:"bytes,4,opt,name=services,proto3" json:"services,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic encoding + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the supplier has staked + Services []*SupplierServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The service configs this supplier can support } func (x *Supplier) Reset() { @@ -685,13 +696,6 @@ func (*Supplier) Descriptor() ([]byte, []int) { return file_poktroll_shared_supplier_proto_rawDescGZIP(), []int{0} } -func (x *Supplier) GetIndex() string { - if x != nil { - return x.Index - } - return "" -} - func (x *Supplier) GetAddress() string { if x != nil { return x.Address @@ -706,11 +710,11 @@ func (x *Supplier) GetStake() *v1beta1.Coin { return nil } -func (x *Supplier) GetServices() string { +func (x *Supplier) GetServices() []*SupplierServiceConfig { if x != nil { return x.Services } - return "" + return nil } var File_poktroll_shared_supplier_proto protoreflect.FileDescriptor @@ -720,17 +724,23 @@ var file_poktroll_shared_supplier_proto_rawDesc = []byte{ 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 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, 0x8d, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, + 0x6f, 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, 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, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, @@ -759,16 +769,18 @@ func file_poktroll_shared_supplier_proto_rawDescGZIP() []byte { var file_poktroll_shared_supplier_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_shared_supplier_proto_goTypes = []interface{}{ - (*Supplier)(nil), // 0: poktroll.shared.Supplier - (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin + (*Supplier)(nil), // 0: poktroll.shared.Supplier + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin + (*SupplierServiceConfig)(nil), // 2: poktroll.shared.SupplierServiceConfig } var file_poktroll_shared_supplier_proto_depIdxs = []int32{ 1, // 0: poktroll.shared.Supplier.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 + 2, // 1: poktroll.shared.Supplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 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_shared_supplier_proto_init() } @@ -776,6 +788,7 @@ func file_poktroll_shared_supplier_proto_init() { if File_poktroll_shared_supplier_proto != nil { return } + file_poktroll_shared_service_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_shared_supplier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Supplier); i { diff --git a/proto/poktroll/shared/supplier.proto b/proto/poktroll/shared/supplier.proto index 122e78000..42c65eb67 100644 --- a/proto/poktroll/shared/supplier.proto +++ b/proto/poktroll/shared/supplier.proto @@ -2,14 +2,15 @@ syntax = "proto3"; package poktroll.shared; option go_package = "github.com/pokt-network/poktroll/x/shared/types"; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "poktroll/shared/service.proto"; +// Supplier is the type defining the actor in Pocket Network that provides RPC services. message Supplier { - string index = 1; - string address = 2; - cosmos.base.v1beta1.Coin stake = 3 [(gogoproto.nullable) = false]; - string services = 4; - + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked + repeated SupplierServiceConfig services = 3; // The service configs this supplier can support } From 0fcc1afc9ec363757b24032b597ff95a019c3b1c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 13 Feb 2024 16:21:01 +0100 Subject: [PATCH 06/23] reconcile: types genesis --- x/supplier/types/genesis.go | 40 ++++- x/supplier/types/genesis_test.go | 267 ++++++++++++++++++++++++++++++- 2 files changed, 295 insertions(+), 12 deletions(-) diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go index f6bd94129..9d06b42ff 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/types/genesis.go @@ -2,6 +2,12 @@ package types import ( "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) // DefaultIndex is the default global index @@ -10,7 +16,7 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - SupplierList: []Supplier{}, + SupplierList: []sharedtypes.Supplier{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -21,14 +27,40 @@ func DefaultGenesis() *GenesisState { func (gs GenesisState) Validate() error { // Check for duplicated index in supplier supplierIndexMap := make(map[string]struct{}) - - for _, elem := range gs.SupplierList { - index := string(SupplierKey(elem.Index)) + for _, supplier := range gs.SupplierList { + index := string(SupplierKey(supplier.Address)) if _, ok := supplierIndexMap[index]; ok { return fmt.Errorf("duplicated index for supplier") } supplierIndexMap[index] = struct{}{} } + + // Check that the stake value for the suppliers is valid + for _, supplier := range gs.SupplierList { + // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, + // similar to how we have `ValidateAppServiceConfigs` below + if supplier.Stake == nil { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") + } + stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) + } + + // Validate the application service configs + if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { + return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) + } + } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.Validate() diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index a7a5f4e06..282c2b01d 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -3,11 +3,48 @@ package types_test import ( "testing" - "github.com/pokt-network/poktroll/x/supplier/types" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" ) func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", math.NewInt(100)) + serviceConfig1 := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + } + serviceList1 := []*sharedtypes.SupplierServiceConfig{serviceConfig1} + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", math.NewInt(100)) + serviceConfig2 := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + } + serviceList2 := []*sharedtypes.SupplierServiceConfig{serviceConfig2} + tests := []struct { desc string genState *types.GenesisState @@ -22,12 +59,16 @@ func TestGenesisState_Validate(t *testing.T) { desc: "valid genesis state", genState: &types.GenesisState{ - SupplierList: []types.Supplier{ + SupplierList: []sharedtypes.Supplier{ { - Index: "0", + Address: addr1, + Stake: &stake1, + Services: serviceList1, }, { - Index: "1", + Address: addr2, + Stake: &stake2, + Services: serviceList2, }, }, // this line is used by starport scaffolding # types/genesis/validField @@ -35,14 +76,224 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "duplicated supplier", + desc: "invalid - zero supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to duplicated supplier address", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr1, + Stake: &stake2, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to nil supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: nil, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to missing supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + // Explicitly missing stake + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing services list", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + // Services: intentionally omitted + }, + }, + }, + valid: false, + }, + { + desc: "invalid - empty services list", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + Services: []*sharedtypes.SupplierServiceConfig{}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - invalid URL", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "invalid URL", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - invalid RPC Type", genState: &types.GenesisState{ - SupplierList: []types.Supplier{ + SupplierList: []sharedtypes.Supplier{ { - Index: "0", + Address: addr1, + Stake: &stake1, + Services: serviceList1, }, { - Index: "0", + Address: addr2, + Stake: &stake2, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_UNKNOWN_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, }, }, }, From 650273565c168b2efcb15a32708e5ec8407695ca Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 13 Feb 2024 16:21:52 +0100 Subject: [PATCH 07/23] reconcile: error types --- x/supplier/types/errors.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go index 0e998c507..b6424cc9f 100644 --- a/x/supplier/types/errors.go +++ b/x/supplier/types/errors.go @@ -8,6 +8,20 @@ import ( // x/supplier 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") + ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") + ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") + ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") + ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") + ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") + ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") + ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") + ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") + ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") + ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") + ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") + ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") + ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") + ErrSupplierInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") + ErrSupplierInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") ) From b14d5180334a6fb6ae56fbc46105e24acb4cad3b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 13 Feb 2024 16:25:45 +0100 Subject: [PATCH 08/23] reconcile: shared service helpers (1/2) --- x/shared/helpers/service_configs.go | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/x/shared/helpers/service_configs.go b/x/shared/helpers/service_configs.go index 95335d058..2719c224f 100644 --- a/x/shared/helpers/service_configs.go +++ b/x/shared/helpers/service_configs.go @@ -6,22 +6,23 @@ import ( sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -// ValidateAppServiceConfigs returns an error if any of the application service configs are invalid -func ValidateAppServiceConfigs(services []*sharedtypes.ApplicationServiceConfig) error { - if len(services) == 0 { - return fmt.Errorf("no services configs provided for application: %v", services) - } - for _, serviceConfig := range services { - if serviceConfig == nil { - return fmt.Errorf("serviceConfig cannot be nil: %v", services) - } - // Check the Service - if !IsValidService(serviceConfig.Service) { - return fmt.Errorf("invalid service: %v", serviceConfig.Service) - } - } - return nil -} +// TODO_IN_THIS_COMMIT: uncomment +//// ValidateAppServiceConfigs returns an error if any of the application service configs are invalid +//func ValidateAppServiceConfigs(services []*sharedtypes.ApplicationServiceConfig) error { +// if len(services) == 0 { +// return fmt.Errorf("no services configs provided for application: %v", services) +// } +// for _, serviceConfig := range services { +// if serviceConfig == nil { +// return fmt.Errorf("serviceConfig cannot be nil: %v", services) +// } +// // Check the Service +// if !IsValidService(serviceConfig.Service) { +// return fmt.Errorf("invalid service: %v", serviceConfig.Service) +// } +// } +// return nil +//} // ValidateSupplierServiceConfigs returns an error if any of the supplier service configs are invalid func ValidateSupplierServiceConfigs(services []*sharedtypes.SupplierServiceConfig) error { From 2fc2f37c56f347b81577e4790df0cbbee2853f5f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 13 Feb 2024 16:37:09 +0100 Subject: [PATCH 09/23] reconcile: module genesis --- testutil/keeper/supplier.go | 2 ++ x/supplier/module/genesis_test.go | 44 +++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go index 3b1fcf575..e848b5e84 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.go @@ -22,6 +22,8 @@ import ( ) func SupplierKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + t.Helper() + storeKey := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() diff --git a/x/supplier/module/genesis_test.go b/x/supplier/module/genesis_test.go index 4d931b698..c98821dc4 100644 --- a/x/supplier/module/genesis_test.go +++ b/x/supplier/module/genesis_test.go @@ -3,23 +3,57 @@ package supplier_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/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/module" "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" ) func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), - - SupplierList: []types.Supplier{ + SupplierList: []sharedtypes.Supplier{ { - Index: "0", + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, }, { - Index: "1", + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, }, }, // this line is used by starport scaffolding # genesis/test/state From c5c6e98e5ec4106cc84f1e043827a3f4b6f8a71f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 13 Feb 2024 17:00:37 +0100 Subject: [PATCH 10/23] reconcile: supplier store (map) --- x/supplier/keeper/supplier.go | 38 ++++++++------- x/supplier/keeper/supplier_test.go | 78 +++++++++++++++++++++--------- 2 files changed, 76 insertions(+), 40 deletions(-) diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go index dc661e8bb..9f2ba9eb3 100644 --- a/x/supplier/keeper/supplier.go +++ b/x/supplier/keeper/supplier.go @@ -6,54 +6,56 @@ import ( "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" ) // SetSupplier set a specific supplier in the store from its index -func (k Keeper) SetSupplier(ctx context.Context, supplier types.Supplier) { +func (k Keeper) SetSupplier(ctx context.Context, supplier sharedtypes.Supplier) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) - b := k.cdc.MustMarshal(&supplier) + supplierBz := k.cdc.MustMarshal(&supplier) store.Set(types.SupplierKey( - supplier.Index, - ), b) + supplier.Address, + ), supplierBz) } // GetSupplier returns a supplier from its index func (k Keeper) GetSupplier( ctx context.Context, - index string, + address string, -) (val types.Supplier, found bool) { +) (supplier sharedtypes.Supplier, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) - b := store.Get(types.SupplierKey( - index, + supplierBz := store.Get(types.SupplierKey( + address, )) - if b == nil { - return val, false + if supplierBz == nil { + return supplier, false } - k.cdc.MustUnmarshal(b, &val) - return val, true + k.cdc.MustUnmarshal(supplierBz, &supplier) + return supplier, true } // RemoveSupplier removes a supplier from the store func (k Keeper) RemoveSupplier( ctx context.Context, - index string, + address string, ) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) store.Delete(types.SupplierKey( - index, + address, )) } // GetAllSupplier returns all supplier -func (k Keeper) GetAllSupplier(ctx context.Context) (list []types.Supplier) { +func (k Keeper) GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Supplier) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) @@ -61,9 +63,9 @@ func (k Keeper) GetAllSupplier(ctx context.Context) (list []types.Supplier) { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Supplier - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) + var supplier sharedtypes.Supplier + k.cdc.MustUnmarshal(iterator.Value(), &supplier) + suppliers = append(suppliers, supplier) } return diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go index 993c3b74b..28e324e07 100644 --- a/x/supplier/keeper/supplier_test.go +++ b/x/supplier/keeper/supplier_test.go @@ -2,62 +2,96 @@ package keeper_test import ( "context" + "fmt" "strconv" "testing" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + 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/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" ) // Prevent strconv unused error var _ = strconv.IntSize -func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []types.Supplier { - items := make([]types.Supplier, n) - for i := range items { - items[i].Index = strconv.Itoa(i) +func init() { + cmd.InitSDKConfig() +} - keeper.SetSupplier(ctx, items[i]) +func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Supplier { + suppliers := make([]sharedtypes.Supplier, n) + for i := range suppliers { + supplier := &suppliers[i] + supplier.Address = sample.AccAddress() + supplier.Stake = &sdk.Coin{Denom: "upokt", Amount: math.NewInt(int64(i))} + supplier.Services = []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: fmt.Sprintf("http://localhost:%d", i), + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + } + keeper.SetSupplier(ctx, *supplier) } - return items + + return suppliers } func TestSupplierGet(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - items := createNSupplier(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetSupplier(ctx, - item.Index, + suppliers := createNSupplier(keeper, ctx, 10) + for _, supplier := range suppliers { + supplierFound, isSupplierFound := keeper.GetSupplier(ctx, + supplier.Address, ) - require.True(t, found) + require.True(t, isSupplierFound) require.Equal(t, - nullify.Fill(&item), - nullify.Fill(&rst), + nullify.Fill(&supplier), + nullify.Fill(&supplierFound), ) } } + func TestSupplierRemove(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - items := createNSupplier(keeper, ctx, 10) - for _, item := range items { + suppliers := createNSupplier(keeper, ctx, 10) + for _, supplier := range suppliers { keeper.RemoveSupplier(ctx, - item.Index, + supplier.Address, ) - _, found := keeper.GetSupplier(ctx, - item.Index, + _, isSupplierFound := keeper.GetSupplier(ctx, + supplier.Address, ) - require.False(t, found) + require.False(t, isSupplierFound) } } func TestSupplierGetAll(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - items := createNSupplier(keeper, ctx, 10) + suppliers := createNSupplier(keeper, ctx, 10) require.ElementsMatch(t, - nullify.Fill(items), + nullify.Fill(suppliers), nullify.Fill(keeper.GetAllSupplier(ctx)), ) } + +// The application module address is derived off of its semantic name. +// This test is a helper for us to easily identify the underlying address. +func TestApplicationModuleAddress(t *testing.T) { + moduleAddress := authtypes.NewModuleAddress(types.ModuleName) + require.Equal(t, "pokt1j40dzzmn6cn9kxku7a5tjnud6hv37vesr5ccaa", moduleAddress.String()) +} From 074575b259feba25d1d864b17359ccfef29fa097 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 13 Feb 2024 17:42:09 +0100 Subject: [PATCH 11/23] reconcile: suppliers query --- api/poktroll/supplier/query.pulsar.go | 561 ++++++++++++----------- proto/poktroll/supplier/query.proto | 27 +- x/supplier/keeper/query_supplier.go | 15 +- x/supplier/keeper/query_supplier_test.go | 26 +- x/supplier/module/autocli.go | 2 +- 5 files changed, 320 insertions(+), 311 deletions(-) diff --git a/api/poktroll/supplier/query.pulsar.go b/api/poktroll/supplier/query.pulsar.go index c66f2da6d..827e8bc66 100644 --- a/api/poktroll/supplier/query.pulsar.go +++ b/api/poktroll/supplier/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" shared "github.com/pokt-network/poktroll/api/poktroll/shared" @@ -810,14 +811,14 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } var ( - md_QueryGetSupplierRequest protoreflect.MessageDescriptor - fd_QueryGetSupplierRequest_index protoreflect.FieldDescriptor + md_QueryGetSupplierRequest protoreflect.MessageDescriptor + fd_QueryGetSupplierRequest_address protoreflect.FieldDescriptor ) func init() { file_poktroll_supplier_query_proto_init() md_QueryGetSupplierRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryGetSupplierRequest") - fd_QueryGetSupplierRequest_index = md_QueryGetSupplierRequest.Fields().ByName("index") + fd_QueryGetSupplierRequest_address = md_QueryGetSupplierRequest.Fields().ByName("address") } var _ protoreflect.Message = (*fastReflection_QueryGetSupplierRequest)(nil) @@ -885,9 +886,9 @@ func (x *fastReflection_QueryGetSupplierRequest) Interface() protoreflect.ProtoM // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QueryGetSupplierRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Index != "" { - value := protoreflect.ValueOfString(x.Index) - if !f(fd_QueryGetSupplierRequest_index, value) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryGetSupplierRequest_address, value) { return } } @@ -906,8 +907,8 @@ func (x *fastReflection_QueryGetSupplierRequest) Range(f func(protoreflect.Field // a repeated field is populated if it is non-empty. func (x *fastReflection_QueryGetSupplierRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.supplier.QueryGetSupplierRequest.index": - return x.Index != "" + case "poktroll.supplier.QueryGetSupplierRequest.address": + return x.Address != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) @@ -924,8 +925,8 @@ func (x *fastReflection_QueryGetSupplierRequest) Has(fd protoreflect.FieldDescri // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryGetSupplierRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.supplier.QueryGetSupplierRequest.index": - x.Index = "" + case "poktroll.supplier.QueryGetSupplierRequest.address": + x.Address = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) @@ -942,8 +943,8 @@ func (x *fastReflection_QueryGetSupplierRequest) Clear(fd protoreflect.FieldDesc // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_QueryGetSupplierRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.supplier.QueryGetSupplierRequest.index": - value := x.Index + case "poktroll.supplier.QueryGetSupplierRequest.address": + value := x.Address return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { @@ -965,8 +966,8 @@ func (x *fastReflection_QueryGetSupplierRequest) Get(descriptor protoreflect.Fie // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryGetSupplierRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.supplier.QueryGetSupplierRequest.index": - x.Index = value.Interface().(string) + case "poktroll.supplier.QueryGetSupplierRequest.address": + x.Address = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) @@ -987,8 +988,8 @@ func (x *fastReflection_QueryGetSupplierRequest) Set(fd protoreflect.FieldDescri // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryGetSupplierRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.QueryGetSupplierRequest.index": - panic(fmt.Errorf("field index of message poktroll.supplier.QueryGetSupplierRequest is not mutable")) + case "poktroll.supplier.QueryGetSupplierRequest.address": + panic(fmt.Errorf("field address of message poktroll.supplier.QueryGetSupplierRequest is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) @@ -1002,7 +1003,7 @@ func (x *fastReflection_QueryGetSupplierRequest) Mutable(fd protoreflect.FieldDe // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_QueryGetSupplierRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.QueryGetSupplierRequest.index": + case "poktroll.supplier.QueryGetSupplierRequest.address": return protoreflect.ValueOfString("") default: if fd.IsExtension() { @@ -1073,7 +1074,7 @@ func (x *fastReflection_QueryGetSupplierRequest) ProtoMethods() *protoiface.Meth var n int var l int _ = l - l = len(x.Index) + l = len(x.Address) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -1106,10 +1107,10 @@ func (x *fastReflection_QueryGetSupplierRequest) ProtoMethods() *protoiface.Meth i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Index) > 0 { - i -= len(x.Index) - copy(dAtA[i:], x.Index) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + 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 } @@ -1164,7 +1165,7 @@ func (x *fastReflection_QueryGetSupplierRequest) ProtoMethods() *protoiface.Meth switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + 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 { @@ -1192,7 +1193,7 @@ func (x *fastReflection_QueryGetSupplierRequest) ProtoMethods() *protoiface.Meth if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Index = string(dAtA[iNdEx:postIndex]) + x.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1665,25 +1666,25 @@ func (x *fastReflection_QueryGetSupplierResponse) ProtoMethods() *protoiface.Met } var ( - md_QueryAllSupplierRequest protoreflect.MessageDescriptor - fd_QueryAllSupplierRequest_pagination protoreflect.FieldDescriptor + md_QueryAllSuppliersRequest protoreflect.MessageDescriptor + fd_QueryAllSuppliersRequest_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_supplier_query_proto_init() - md_QueryAllSupplierRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSupplierRequest") - fd_QueryAllSupplierRequest_pagination = md_QueryAllSupplierRequest.Fields().ByName("pagination") + md_QueryAllSuppliersRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSuppliersRequest") + fd_QueryAllSuppliersRequest_pagination = md_QueryAllSuppliersRequest.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllSupplierRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllSuppliersRequest)(nil) -type fastReflection_QueryAllSupplierRequest QueryAllSupplierRequest +type fastReflection_QueryAllSuppliersRequest QueryAllSuppliersRequest -func (x *QueryAllSupplierRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllSupplierRequest)(x) +func (x *QueryAllSuppliersRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersRequest)(x) } -func (x *QueryAllSupplierRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryAllSuppliersRequest) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_supplier_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1695,43 +1696,43 @@ func (x *QueryAllSupplierRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllSupplierRequest_messageType fastReflection_QueryAllSupplierRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllSupplierRequest_messageType{} +var _fastReflection_QueryAllSuppliersRequest_messageType fastReflection_QueryAllSuppliersRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllSuppliersRequest_messageType{} -type fastReflection_QueryAllSupplierRequest_messageType struct{} +type fastReflection_QueryAllSuppliersRequest_messageType struct{} -func (x fastReflection_QueryAllSupplierRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllSupplierRequest)(nil) +func (x fastReflection_QueryAllSuppliersRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersRequest)(nil) } -func (x fastReflection_QueryAllSupplierRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllSupplierRequest) +func (x fastReflection_QueryAllSuppliersRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersRequest) } -func (x fastReflection_QueryAllSupplierRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllSupplierRequest +func (x fastReflection_QueryAllSuppliersRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllSupplierRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllSupplierRequest +func (x *fastReflection_QueryAllSuppliersRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersRequest } // 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_QueryAllSupplierRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryAllSupplierRequest_messageType +func (x *fastReflection_QueryAllSuppliersRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllSuppliersRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllSupplierRequest) New() protoreflect.Message { - return new(fastReflection_QueryAllSupplierRequest) +func (x *fastReflection_QueryAllSuppliersRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllSupplierRequest) Interface() protoreflect.ProtoMessage { - return (*QueryAllSupplierRequest)(x) +func (x *fastReflection_QueryAllSuppliersRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllSuppliersRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1739,10 +1740,10 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllSuppliersRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllSupplierRequest_pagination, value) { + if !f(fd_QueryAllSuppliersRequest_pagination, value) { return } } @@ -1759,15 +1760,15 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllSuppliersRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierRequest.pagination": + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) } } @@ -1777,15 +1778,15 @@ func (x *fastReflection_QueryAllSupplierRequest) Has(fd protoreflect.FieldDescri // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllSupplierRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllSuppliersRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierRequest.pagination": + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) } } @@ -1795,16 +1796,16 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllSuppliersRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.supplier.QueryAllSupplierRequest.pagination": + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", descriptor.FullName())) } } @@ -1818,15 +1819,15 @@ func (x *fastReflection_QueryAllSupplierRequest) Get(descriptor protoreflect.Fie // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllSupplierRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllSuppliersRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierRequest.pagination": + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) } } @@ -1840,44 +1841,44 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllSuppliersRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierRequest.pagination": + case "poktroll.supplier.QueryAllSuppliersRequest.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.supplier.QueryAllSupplierRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest 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_QueryAllSupplierRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllSuppliersRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierRequest.pagination": + case "poktroll.supplier.QueryAllSuppliersRequest.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.supplier.QueryAllSupplierRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest 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_QueryAllSupplierRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllSuppliersRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSupplierRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSuppliersRequest", d.FullName())) } panic("unreachable") } @@ -1885,7 +1886,7 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllSuppliersRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1896,7 +1897,7 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllSuppliersRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1908,7 +1909,7 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) IsValid() bool { +func (x *fastReflection_QueryAllSuppliersRequest) IsValid() bool { return x != nil } @@ -1918,9 +1919,9 @@ func (x *fastReflection_QueryAllSupplierRequest) 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_QueryAllSupplierRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllSuppliersRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllSupplierRequest) + x := input.Message.Interface().(*QueryAllSuppliersRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1946,7 +1947,7 @@ func (x *fastReflection_QueryAllSupplierRequest) ProtoMethods() *protoiface.Meth } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllSupplierRequest) + x := input.Message.Interface().(*QueryAllSuppliersRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1990,7 +1991,7 @@ func (x *fastReflection_QueryAllSupplierRequest) ProtoMethods() *protoiface.Meth }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllSupplierRequest) + x := input.Message.Interface().(*QueryAllSuppliersRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2022,10 +2023,10 @@ func (x *fastReflection_QueryAllSupplierRequest) 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: QueryAllSupplierRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSupplierRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2099,79 +2100,79 @@ func (x *fastReflection_QueryAllSupplierRequest) ProtoMethods() *protoiface.Meth } } -var _ protoreflect.List = (*_QueryAllSupplierResponse_1_list)(nil) +var _ protoreflect.List = (*_QueryAllSuppliersResponse_1_list)(nil) -type _QueryAllSupplierResponse_1_list struct { +type _QueryAllSuppliersResponse_1_list struct { list *[]*shared.Supplier } -func (x *_QueryAllSupplierResponse_1_list) Len() int { +func (x *_QueryAllSuppliersResponse_1_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_QueryAllSupplierResponse_1_list) Get(i int) protoreflect.Value { +func (x *_QueryAllSuppliersResponse_1_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_QueryAllSupplierResponse_1_list) Set(i int, value protoreflect.Value) { +func (x *_QueryAllSuppliersResponse_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*shared.Supplier) (*x.list)[i] = concreteValue } -func (x *_QueryAllSupplierResponse_1_list) Append(value protoreflect.Value) { +func (x *_QueryAllSuppliersResponse_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*shared.Supplier) *x.list = append(*x.list, concreteValue) } -func (x *_QueryAllSupplierResponse_1_list) AppendMutable() protoreflect.Value { +func (x *_QueryAllSuppliersResponse_1_list) AppendMutable() protoreflect.Value { v := new(shared.Supplier) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllSupplierResponse_1_list) Truncate(n int) { +func (x *_QueryAllSuppliersResponse_1_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_QueryAllSupplierResponse_1_list) NewElement() protoreflect.Value { +func (x *_QueryAllSuppliersResponse_1_list) NewElement() protoreflect.Value { v := new(shared.Supplier) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllSupplierResponse_1_list) IsValid() bool { +func (x *_QueryAllSuppliersResponse_1_list) IsValid() bool { return x.list != nil } var ( - md_QueryAllSupplierResponse protoreflect.MessageDescriptor - fd_QueryAllSupplierResponse_supplier protoreflect.FieldDescriptor - fd_QueryAllSupplierResponse_pagination protoreflect.FieldDescriptor + md_QueryAllSuppliersResponse protoreflect.MessageDescriptor + fd_QueryAllSuppliersResponse_supplier protoreflect.FieldDescriptor + fd_QueryAllSuppliersResponse_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_supplier_query_proto_init() - md_QueryAllSupplierResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSupplierResponse") - fd_QueryAllSupplierResponse_supplier = md_QueryAllSupplierResponse.Fields().ByName("supplier") - fd_QueryAllSupplierResponse_pagination = md_QueryAllSupplierResponse.Fields().ByName("pagination") + md_QueryAllSuppliersResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSuppliersResponse") + fd_QueryAllSuppliersResponse_supplier = md_QueryAllSuppliersResponse.Fields().ByName("supplier") + fd_QueryAllSuppliersResponse_pagination = md_QueryAllSuppliersResponse.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllSupplierResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllSuppliersResponse)(nil) -type fastReflection_QueryAllSupplierResponse QueryAllSupplierResponse +type fastReflection_QueryAllSuppliersResponse QueryAllSuppliersResponse -func (x *QueryAllSupplierResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllSupplierResponse)(x) +func (x *QueryAllSuppliersResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersResponse)(x) } -func (x *QueryAllSupplierResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryAllSuppliersResponse) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_supplier_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2183,43 +2184,43 @@ func (x *QueryAllSupplierResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllSupplierResponse_messageType fastReflection_QueryAllSupplierResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllSupplierResponse_messageType{} +var _fastReflection_QueryAllSuppliersResponse_messageType fastReflection_QueryAllSuppliersResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllSuppliersResponse_messageType{} -type fastReflection_QueryAllSupplierResponse_messageType struct{} +type fastReflection_QueryAllSuppliersResponse_messageType struct{} -func (x fastReflection_QueryAllSupplierResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllSupplierResponse)(nil) +func (x fastReflection_QueryAllSuppliersResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersResponse)(nil) } -func (x fastReflection_QueryAllSupplierResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllSupplierResponse) +func (x fastReflection_QueryAllSuppliersResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersResponse) } -func (x fastReflection_QueryAllSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllSupplierResponse +func (x fastReflection_QueryAllSuppliersResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllSupplierResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllSupplierResponse +func (x *fastReflection_QueryAllSuppliersResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersResponse } // 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_QueryAllSupplierResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryAllSupplierResponse_messageType +func (x *fastReflection_QueryAllSuppliersResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllSuppliersResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllSupplierResponse) New() protoreflect.Message { - return new(fastReflection_QueryAllSupplierResponse) +func (x *fastReflection_QueryAllSuppliersResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllSupplierResponse) Interface() protoreflect.ProtoMessage { - return (*QueryAllSupplierResponse)(x) +func (x *fastReflection_QueryAllSuppliersResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllSuppliersResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2227,16 +2228,16 @@ func (x *fastReflection_QueryAllSupplierResponse) Interface() protoreflect.Proto // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllSupplierResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllSuppliersResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if len(x.Supplier) != 0 { - value := protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{list: &x.Supplier}) - if !f(fd_QueryAllSupplierResponse_supplier, value) { + value := protoreflect.ValueOfList(&_QueryAllSuppliersResponse_1_list{list: &x.Supplier}) + if !f(fd_QueryAllSuppliersResponse_supplier, value) { return } } if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllSupplierResponse_pagination, value) { + if !f(fd_QueryAllSuppliersResponse_pagination, value) { return } } @@ -2253,17 +2254,17 @@ func (x *fastReflection_QueryAllSupplierResponse) Range(f func(protoreflect.Fiel // 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_QueryAllSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllSuppliersResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierResponse.supplier": + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": return len(x.Supplier) != 0 - case "poktroll.supplier.QueryAllSupplierResponse.pagination": + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) } } @@ -2273,17 +2274,17 @@ func (x *fastReflection_QueryAllSupplierResponse) Has(fd protoreflect.FieldDescr // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllSuppliersResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierResponse.supplier": + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": x.Supplier = nil - case "poktroll.supplier.QueryAllSupplierResponse.pagination": + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) } } @@ -2293,22 +2294,22 @@ func (x *fastReflection_QueryAllSupplierResponse) Clear(fd protoreflect.FieldDes // 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_QueryAllSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllSuppliersResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.supplier.QueryAllSupplierResponse.supplier": + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": if len(x.Supplier) == 0 { - return protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{}) + return protoreflect.ValueOfList(&_QueryAllSuppliersResponse_1_list{}) } - listValue := &_QueryAllSupplierResponse_1_list{list: &x.Supplier} + listValue := &_QueryAllSuppliersResponse_1_list{list: &x.Supplier} return protoreflect.ValueOfList(listValue) - case "poktroll.supplier.QueryAllSupplierResponse.pagination": + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", descriptor.FullName())) } } @@ -2322,19 +2323,19 @@ func (x *fastReflection_QueryAllSupplierResponse) Get(descriptor protoreflect.Fi // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllSuppliersResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierResponse.supplier": + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": lv := value.List() - clv := lv.(*_QueryAllSupplierResponse_1_list) + clv := lv.(*_QueryAllSuppliersResponse_1_list) x.Supplier = *clv.list - case "poktroll.supplier.QueryAllSupplierResponse.pagination": + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSupplierResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) } } @@ -2348,53 +2349,53 @@ func (x *fastReflection_QueryAllSupplierResponse) Set(fd protoreflect.FieldDescr // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllSuppliersResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierResponse.supplier": + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": if x.Supplier == nil { x.Supplier = []*shared.Supplier{} } - value := &_QueryAllSupplierResponse_1_list{list: &x.Supplier} + value := &_QueryAllSuppliersResponse_1_list{list: &x.Supplier} return protoreflect.ValueOfList(value) - case "poktroll.supplier.QueryAllSupplierResponse.pagination": + case "poktroll.supplier.QueryAllSuppliersResponse.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.supplier.QueryAllSupplierResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse 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_QueryAllSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllSuppliersResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.supplier.QueryAllSupplierResponse.supplier": + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": list := []*shared.Supplier{} - return protoreflect.ValueOfList(&_QueryAllSupplierResponse_1_list{list: &list}) - case "poktroll.supplier.QueryAllSupplierResponse.pagination": + return protoreflect.ValueOfList(&_QueryAllSuppliersResponse_1_list{list: &list}) + case "poktroll.supplier.QueryAllSuppliersResponse.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.supplier.QueryAllSupplierResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) } - panic(fmt.Errorf("message poktroll.supplier.QueryAllSupplierResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse 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_QueryAllSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllSuppliersResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSupplierResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSuppliersResponse", d.FullName())) } panic("unreachable") } @@ -2402,7 +2403,7 @@ func (x *fastReflection_QueryAllSupplierResponse) WhichOneof(d protoreflect.Oneo // 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_QueryAllSupplierResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllSuppliersResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2413,7 +2414,7 @@ func (x *fastReflection_QueryAllSupplierResponse) GetUnknown() protoreflect.RawF // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllSupplierResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllSuppliersResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2425,7 +2426,7 @@ func (x *fastReflection_QueryAllSupplierResponse) 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_QueryAllSupplierResponse) IsValid() bool { +func (x *fastReflection_QueryAllSuppliersResponse) IsValid() bool { return x != nil } @@ -2435,9 +2436,9 @@ func (x *fastReflection_QueryAllSupplierResponse) 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_QueryAllSupplierResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllSuppliersResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllSupplierResponse) + x := input.Message.Interface().(*QueryAllSuppliersResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2469,7 +2470,7 @@ func (x *fastReflection_QueryAllSupplierResponse) ProtoMethods() *protoiface.Met } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllSupplierResponse) + x := input.Message.Interface().(*QueryAllSuppliersResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2529,7 +2530,7 @@ func (x *fastReflection_QueryAllSupplierResponse) ProtoMethods() *protoiface.Met }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllSupplierResponse) + x := input.Message.Interface().(*QueryAllSuppliersResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2561,10 +2562,10 @@ func (x *fastReflection_QueryAllSupplierResponse) ProtoMethods() *protoiface.Met fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSupplierResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSupplierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2754,7 +2755,7 @@ type QueryGetSupplierRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } func (x *QueryGetSupplierRequest) Reset() { @@ -2777,9 +2778,9 @@ func (*QueryGetSupplierRequest) Descriptor() ([]byte, []int) { return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{2} } -func (x *QueryGetSupplierRequest) GetIndex() string { +func (x *QueryGetSupplierRequest) GetAddress() string { if x != nil { - return x.Index + return x.Address } return "" } @@ -2819,7 +2820,7 @@ func (x *QueryGetSupplierResponse) GetSupplier() *shared.Supplier { return nil } -type QueryAllSupplierRequest struct { +type QueryAllSuppliersRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2827,8 +2828,8 @@ type QueryAllSupplierRequest struct { Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllSupplierRequest) Reset() { - *x = QueryAllSupplierRequest{} +func (x *QueryAllSuppliersRequest) Reset() { + *x = QueryAllSuppliersRequest{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_supplier_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2836,25 +2837,25 @@ func (x *QueryAllSupplierRequest) Reset() { } } -func (x *QueryAllSupplierRequest) String() string { +func (x *QueryAllSuppliersRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllSupplierRequest) ProtoMessage() {} +func (*QueryAllSuppliersRequest) ProtoMessage() {} -// Deprecated: Use QueryAllSupplierRequest.ProtoReflect.Descriptor instead. -func (*QueryAllSupplierRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllSuppliersRequest.ProtoReflect.Descriptor instead. +func (*QueryAllSuppliersRequest) Descriptor() ([]byte, []int) { return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{4} } -func (x *QueryAllSupplierRequest) GetPagination() *v1beta1.PageRequest { +func (x *QueryAllSuppliersRequest) GetPagination() *v1beta1.PageRequest { if x != nil { return x.Pagination } return nil } -type QueryAllSupplierResponse struct { +type QueryAllSuppliersResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2863,8 +2864,8 @@ type QueryAllSupplierResponse struct { Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllSupplierResponse) Reset() { - *x = QueryAllSupplierResponse{} +func (x *QueryAllSuppliersResponse) Reset() { + *x = QueryAllSuppliersResponse{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_supplier_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2872,25 +2873,25 @@ func (x *QueryAllSupplierResponse) Reset() { } } -func (x *QueryAllSupplierResponse) String() string { +func (x *QueryAllSuppliersResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllSupplierResponse) ProtoMessage() {} +func (*QueryAllSuppliersResponse) ProtoMessage() {} -// Deprecated: Use QueryAllSupplierResponse.ProtoReflect.Descriptor instead. -func (*QueryAllSupplierResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllSuppliersResponse.ProtoReflect.Descriptor instead. +func (*QueryAllSuppliersResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryAllSupplierResponse) GetSupplier() []*shared.Supplier { +func (x *QueryAllSuppliersResponse) GetSupplier() []*shared.Supplier { if x != nil { return x.Supplier } return nil } -func (x *QueryAllSupplierResponse) GetPagination() *v1beta1.PageResponse { +func (x *QueryAllSuppliersResponse) GetPagination() *v1beta1.PageResponse { if x != nil { return x.Pagination } @@ -2907,73 +2908,77 @@ var file_poktroll_supplier_query_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, 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, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x0a, 0x13, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, - 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x22, 0x2f, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x22, 0x57, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, - 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xcc, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, + 0x6f, 0x6e, 0x73, 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, 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, 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, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x53, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 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, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0b, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x41, 0x6c, 0x6c, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, - 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, + 0x72, 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, 0x4d, 0x0a, 0x17, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x57, 0x0a, 0x18, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x22, 0x62, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xa1, 0x01, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 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, 0xd1, 0x03, 0x0a, 0x05, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x9f, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x12, 0x32, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x7d, 0x12, 0x9b, 0x01, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x73, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, @@ -3005,29 +3010,29 @@ func file_poktroll_supplier_query_proto_rawDescGZIP() []byte { var file_poktroll_supplier_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_supplier_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.supplier.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.supplier.QueryParamsResponse - (*QueryGetSupplierRequest)(nil), // 2: poktroll.supplier.QueryGetSupplierRequest - (*QueryGetSupplierResponse)(nil), // 3: poktroll.supplier.QueryGetSupplierResponse - (*QueryAllSupplierRequest)(nil), // 4: poktroll.supplier.QueryAllSupplierRequest - (*QueryAllSupplierResponse)(nil), // 5: poktroll.supplier.QueryAllSupplierResponse - (*Params)(nil), // 6: poktroll.supplier.Params - (*shared.Supplier)(nil), // 7: poktroll.shared.Supplier - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.supplier.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.supplier.QueryParamsResponse + (*QueryGetSupplierRequest)(nil), // 2: poktroll.supplier.QueryGetSupplierRequest + (*QueryGetSupplierResponse)(nil), // 3: poktroll.supplier.QueryGetSupplierResponse + (*QueryAllSuppliersRequest)(nil), // 4: poktroll.supplier.QueryAllSuppliersRequest + (*QueryAllSuppliersResponse)(nil), // 5: poktroll.supplier.QueryAllSuppliersResponse + (*Params)(nil), // 6: poktroll.supplier.Params + (*shared.Supplier)(nil), // 7: poktroll.shared.Supplier + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_supplier_query_proto_depIdxs = []int32{ 6, // 0: poktroll.supplier.QueryParamsResponse.params:type_name -> poktroll.supplier.Params 7, // 1: poktroll.supplier.QueryGetSupplierResponse.supplier:type_name -> poktroll.shared.Supplier - 8, // 2: poktroll.supplier.QueryAllSupplierRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.supplier.QueryAllSupplierResponse.supplier:type_name -> poktroll.shared.Supplier - 9, // 4: poktroll.supplier.QueryAllSupplierResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 8, // 2: poktroll.supplier.QueryAllSuppliersRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.supplier.QueryAllSuppliersResponse.supplier:type_name -> poktroll.shared.Supplier + 9, // 4: poktroll.supplier.QueryAllSuppliersResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 0, // 5: poktroll.supplier.Query.Params:input_type -> poktroll.supplier.QueryParamsRequest 2, // 6: poktroll.supplier.Query.Supplier:input_type -> poktroll.supplier.QueryGetSupplierRequest - 4, // 7: poktroll.supplier.Query.SupplierAll:input_type -> poktroll.supplier.QueryAllSupplierRequest + 4, // 7: poktroll.supplier.Query.AllSuppliers:input_type -> poktroll.supplier.QueryAllSuppliersRequest 1, // 8: poktroll.supplier.Query.Params:output_type -> poktroll.supplier.QueryParamsResponse 3, // 9: poktroll.supplier.Query.Supplier:output_type -> poktroll.supplier.QueryGetSupplierResponse - 5, // 10: poktroll.supplier.Query.SupplierAll:output_type -> poktroll.supplier.QueryAllSupplierResponse + 5, // 10: poktroll.supplier.Query.AllSuppliers:output_type -> poktroll.supplier.QueryAllSuppliersResponse 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 @@ -3091,7 +3096,7 @@ func file_poktroll_supplier_query_proto_init() { } } file_poktroll_supplier_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllSupplierRequest); i { + switch v := v.(*QueryAllSuppliersRequest); i { case 0: return &v.state case 1: @@ -3103,7 +3108,7 @@ func file_poktroll_supplier_query_proto_init() { } } file_poktroll_supplier_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllSupplierResponse); i { + switch v := v.(*QueryAllSuppliersResponse); i { case 0: return &v.state case 1: diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto index 0f1b27663..8d3ad532d 100644 --- a/proto/poktroll/supplier/query.proto +++ b/proto/poktroll/supplier/query.proto @@ -5,30 +5,31 @@ package poktroll.supplier; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "poktroll/supplier/params.proto"; import "poktroll/shared/supplier.proto"; -import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/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/supplier/params"; - + } - + // Queries a list of Supplier items. rpc Supplier (QueryGetSupplierRequest) returns (QueryGetSupplierResponse) { - option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier/{index}"; - + option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier/{address}"; + } - rpc SupplierAll (QueryAllSupplierRequest) returns (QueryAllSupplierResponse) { + rpc AllSuppliers (QueryAllSuppliersRequest) returns (QueryAllSuppliersResponse) { option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier"; - + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -36,25 +37,25 @@ 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 QueryGetSupplierRequest { - string index = 1; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message QueryGetSupplierResponse { poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; } -message QueryAllSupplierRequest { +message QueryAllSuppliersRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllSupplierResponse { - repeated poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; +message QueryAllSuppliersResponse { + repeated poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go index 33bdb0b0e..d364ede93 100644 --- a/x/supplier/keeper/query_supplier.go +++ b/x/supplier/keeper/query_supplier.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/runtime" @@ -13,7 +14,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) SupplierAll(ctx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { +func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRequest) (*types.QueryAllSuppliersResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -37,7 +38,7 @@ func (k Keeper) SupplierAll(ctx context.Context, req *types.QueryAllSupplierRequ return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryAllSupplierResponse{Supplier: suppliers, Pagination: pageRes}, nil + return &types.QueryAllSuppliersResponse{Supplier: suppliers, Pagination: pageRes}, nil } func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { @@ -45,13 +46,15 @@ func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest return nil, status.Error(codes.InvalidArgument, "invalid request") } - val, found := k.GetSupplier( + supplier, found := k.GetSupplier( ctx, - req.Index, + req.Address, ) if !found { - return nil, status.Error(codes.NotFound, "not found") + // TODO_TECHDEBT(#181): conform to logging conventions once established + msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) + return nil, status.Error(codes.NotFound, msg) } - return &types.QueryGetSupplierResponse{Supplier: val}, nil + return &types.QueryGetSupplierResponse{Supplier: supplier}, nil } diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go index 7d950dc42..ca80180c3 100644 --- a/x/supplier/keeper/query_supplier_test.go +++ b/x/supplier/keeper/query_supplier_test.go @@ -19,7 +19,7 @@ var _ = strconv.IntSize func TestSupplierQuerySingle(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - msgs := createNSupplier(keeper, ctx, 2) + suppliers := createNSupplier(keeper, ctx, 2) tests := []struct { desc string request *types.QueryGetSupplierRequest @@ -29,23 +29,23 @@ func TestSupplierQuerySingle(t *testing.T) { { desc: "First", request: &types.QueryGetSupplierRequest{ - Index: msgs[0].Index, + Address: suppliers[0].Address, }, - response: &types.QueryGetSupplierResponse{Supplier: msgs[0]}, + response: &types.QueryGetSupplierResponse{Supplier: suppliers[0]}, }, { desc: "Second", request: &types.QueryGetSupplierRequest{ - Index: msgs[1].Index, + Address: suppliers[1].Address, }, - response: &types.QueryGetSupplierResponse{Supplier: msgs[1]}, + response: &types.QueryGetSupplierResponse{Supplier: suppliers[1]}, }, { desc: "KeyNotFound", request: &types.QueryGetSupplierRequest{ - Index: strconv.Itoa(100000), + Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "not found"), + err: status.Error(codes.NotFound, "supplier with address \"100000\""), }, { desc: "InvalidRequest", @@ -72,8 +72,8 @@ func TestSupplierQueryPaginated(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) msgs := createNSupplier(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSupplierRequest { - return &types.QueryAllSupplierRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSuppliersRequest { + return &types.QueryAllSuppliersRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -85,7 +85,7 @@ func TestSupplierQueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(ctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.AllSuppliers(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.Supplier), step) require.Subset(t, @@ -98,7 +98,7 @@ func TestSupplierQueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(ctx, request(next, 0, uint64(step), false)) + resp, err := keeper.AllSuppliers(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.Supplier), step) require.Subset(t, @@ -109,7 +109,7 @@ func TestSupplierQueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.SupplierAll(ctx, request(nil, 0, 0, true)) + resp, err := keeper.AllSuppliers(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -118,7 +118,7 @@ func TestSupplierQueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.SupplierAll(ctx, nil) + _, err := keeper.AllSuppliers(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index 2325ea034..c93ecb201 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -18,7 +18,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Shows the parameters of the module", }, { - RpcMethod: "SupplierAll", + RpcMethod: "AllSuppliers", Use: "list-supplier", Short: "List all supplier", }, From 47c6d4a6a22623a0cf211a0e3c43020cb125eeff Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 11:18:15 +0100 Subject: [PATCH 12/23] scaffold: message stake-supplier --module supplier --signer address stake:coin services --- api/poktroll/supplier/tx.pulsar.go | 1090 ++++++++++++++++- proto/poktroll/supplier/tx.proto | 33 +- .../keeper/msg_server_stake_supplier.go | 95 +- x/supplier/module/autocli.go | 6 + x/supplier/module/simulation.go | 25 +- x/supplier/simulation/stake_supplier.go | 6 +- x/supplier/types/codec.go | 3 + x/supplier/types/message_stake_supplier.go | 68 +- .../types/message_stake_supplier_test.go | 269 +--- 9 files changed, 1137 insertions(+), 458 deletions(-) diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index 91020fcfe..ed51c87e8 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -3,6 +3,7 @@ package supplier 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,925 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgStakeSupplier protoreflect.MessageDescriptor + fd_MsgStakeSupplier_address protoreflect.FieldDescriptor + fd_MsgStakeSupplier_stake protoreflect.FieldDescriptor + fd_MsgStakeSupplier_services protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgStakeSupplier = File_poktroll_supplier_tx_proto.Messages().ByName("MsgStakeSupplier") + fd_MsgStakeSupplier_address = md_MsgStakeSupplier.Fields().ByName("address") + fd_MsgStakeSupplier_stake = md_MsgStakeSupplier.Fields().ByName("stake") + fd_MsgStakeSupplier_services = md_MsgStakeSupplier.Fields().ByName("services") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeSupplier)(nil) + +type fastReflection_MsgStakeSupplier MsgStakeSupplier + +func (x *MsgStakeSupplier) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeSupplier)(x) +} + +func (x *MsgStakeSupplier) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_MsgStakeSupplier_messageType fastReflection_MsgStakeSupplier_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeSupplier_messageType{} + +type fastReflection_MsgStakeSupplier_messageType struct{} + +func (x fastReflection_MsgStakeSupplier_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeSupplier)(nil) +} +func (x fastReflection_MsgStakeSupplier_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplier) +} +func (x fastReflection_MsgStakeSupplier_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplier +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeSupplier) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplier +} + +// 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_MsgStakeSupplier) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeSupplier_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeSupplier) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplier) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeSupplier) Interface() protoreflect.ProtoMessage { + return (*MsgStakeSupplier)(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_MsgStakeSupplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgStakeSupplier_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_MsgStakeSupplier_stake, value) { + return + } + } + if x.Services != "" { + value := protoreflect.ValueOfString(x.Services) + if !f(fd_MsgStakeSupplier_services, 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_MsgStakeSupplier) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + return x.Address != "" + case "poktroll.supplier.MsgStakeSupplier.stake": + return x.Stake != nil + case "poktroll.supplier.MsgStakeSupplier.services": + return x.Services != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier 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_MsgStakeSupplier) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + x.Address = "" + case "poktroll.supplier.MsgStakeSupplier.stake": + x.Stake = nil + case "poktroll.supplier.MsgStakeSupplier.services": + x.Services = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier 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_MsgStakeSupplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgStakeSupplier.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.services": + value := x.Services + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier 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_MsgStakeSupplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + x.Address = value.Interface().(string) + case "poktroll.supplier.MsgStakeSupplier.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.supplier.MsgStakeSupplier.services": + x.Services = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier 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_MsgStakeSupplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.address": + panic(fmt.Errorf("field address of message poktroll.supplier.MsgStakeSupplier is not mutable")) + case "poktroll.supplier.MsgStakeSupplier.services": + panic(fmt.Errorf("field services of message poktroll.supplier.MsgStakeSupplier is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier 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_MsgStakeSupplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgStakeSupplier.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.services": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier 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_MsgStakeSupplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgStakeSupplier", 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_MsgStakeSupplier) 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_MsgStakeSupplier) 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_MsgStakeSupplier) 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_MsgStakeSupplier) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeSupplier) + 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)) + } + l = len(x.Services) + 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().(*MsgStakeSupplier) + 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.Services) > 0 { + i -= len(x.Services) + copy(dAtA[i:], x.Services) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Services))) + i-- + dAtA[i] = 0x1a + } + 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().(*MsgStakeSupplier) + 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: MsgStakeSupplier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeSupplier: 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 + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", 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.Services = 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_MsgStakeSupplierResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgStakeSupplierResponse = File_poktroll_supplier_tx_proto.Messages().ByName("MsgStakeSupplierResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeSupplierResponse)(nil) + +type fastReflection_MsgStakeSupplierResponse MsgStakeSupplierResponse + +func (x *MsgStakeSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeSupplierResponse)(x) +} + +func (x *MsgStakeSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_MsgStakeSupplierResponse_messageType fastReflection_MsgStakeSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeSupplierResponse_messageType{} + +type fastReflection_MsgStakeSupplierResponse_messageType struct{} + +func (x fastReflection_MsgStakeSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeSupplierResponse)(nil) +} +func (x fastReflection_MsgStakeSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplierResponse) +} +func (x fastReflection_MsgStakeSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplierResponse +} + +// 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_MsgStakeSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeSupplierResponse) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*MsgStakeSupplierResponse)(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_MsgStakeSupplierResponse) 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_MsgStakeSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse 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_MsgStakeSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse 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_MsgStakeSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse 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_MsgStakeSupplierResponse) 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.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse 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_MsgStakeSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse 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_MsgStakeSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse 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_MsgStakeSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgStakeSupplierResponse", 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_MsgStakeSupplierResponse) 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_MsgStakeSupplierResponse) 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_MsgStakeSupplierResponse) 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_MsgStakeSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeSupplierResponse) + 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().(*MsgStakeSupplierResponse) + 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().(*MsgStakeSupplierResponse) + 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: MsgStakeSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeSupplierResponse: 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 +1812,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 +1878,83 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{1} } +type MsgStakeSupplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + Services string `protobuf:"bytes,3,opt,name=services,proto3" json:"services,omitempty"` +} + +func (x *MsgStakeSupplier) Reset() { + *x = MsgStakeSupplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeSupplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeSupplier) ProtoMessage() {} + +// Deprecated: Use MsgStakeSupplier.ProtoReflect.Descriptor instead. +func (*MsgStakeSupplier) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeSupplier) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgStakeSupplier) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *MsgStakeSupplier) GetServices() string { + if x != nil { + return x.Services + } + return "" +} + +type MsgStakeSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeSupplierResponse) Reset() { + *x = MsgStakeSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeSupplierResponse) ProtoMessage() {} + +// Deprecated: Use MsgStakeSupplierResponse.ProtoReflect.Descriptor instead. +func (*MsgStakeSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{3} +} + var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor var file_poktroll_supplier_tx_proto_rawDesc = []byte{ @@ -973,7 +1968,9 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 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, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, + 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, 0xbf, 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, @@ -987,13 +1984,30 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x6c, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x10, 0x4d, 0x73, + 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, + 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, + 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, 0x0a, + 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, + 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x23, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, @@ -1020,21 +2034,27 @@ func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { return file_poktroll_supplier_tx_proto_rawDescData } -var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse - (*Params)(nil), // 2: poktroll.supplier.Params + (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse + (*MsgStakeSupplier)(nil), // 2: poktroll.supplier.MsgStakeSupplier + (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse + (*Params)(nil), // 4: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin } var file_poktroll_supplier_tx_proto_depIdxs = []int32{ - 2, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params - 0, // 1: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams - 1, // 2: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.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.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params + 5, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin + 0, // 2: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 2, // 3: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier + 1, // 4: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 5: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 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_supplier_tx_proto_init() } @@ -1068,6 +2088,30 @@ func file_poktroll_supplier_tx_proto_init() { return nil } } + file_poktroll_supplier_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeSupplier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeSupplierResponse); 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{ @@ -1075,7 +2119,7 @@ func file_poktroll_supplier_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_supplier_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 6e3498e66..df81f2a54 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.supplier; import "amino/amino.proto"; @@ -6,35 +7,43 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "poktroll/supplier/params.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/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 StakeSupplier (MsgStakeSupplier) returns (MsgStakeSupplierResponse); } - // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // 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 MsgStakeSupplier { + option (cosmos.msg.v1.signer) = "address"; + string address = 1; + cosmos.base.v1beta1.Coin stake = 2 [(gogoproto.nullable) = false]; + string services = 3; +} + +message MsgStakeSupplierResponse {} + diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index edd8ecee8..812efdbef 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -2,105 +2,16 @@ package keeper import ( "context" - "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) StakeSupplier( - goCtx context.Context, - msg *types.MsgStakeSupplier, -) (*types.MsgStakeSupplierResponse, error) { +func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "StakeSupplier") - logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) - return nil, err - } - - // Check if the supplier already exists or not - var err error - var coinsToDelegate sdk.Coin - supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) - if !isSupplierFound { - logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) - supplier = k.createSupplier(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Supplier found. Updating supplier for address %s", msg.Address)) - currSupplierStake := *supplier.Stake - if err = k.updateSupplier(ctx, &supplier, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currSupplierStake) - } - - // Retrieve the address of the supplier - supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? - // Send the coins from the supplier to the staked supplier pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, supplierAddress, 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, supplierAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Supplier in the store - k.SetSupplier(ctx, supplier) - logger.Info(fmt.Sprintf("Successfully updated supplier stake for supplier: %+v", supplier)) + // TODO: Handling the message + _ = ctx return &types.MsgStakeSupplierResponse{}, nil } - -func (k msgServer) createSupplier( - ctx sdk.Context, - msg *types.MsgStakeSupplier, -) sharedtypes.Supplier { - return sharedtypes.Supplier{ - Address: msg.Address, - Stake: msg.Stake, - Services: msg.Services, - } -} - -func (k msgServer) updateSupplier( - ctx sdk.Context, - supplier *sharedtypes.Supplier, - msg *types.MsgStakeSupplier, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != supplier.Address { - return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) - } - - // Validate that the stake is not being lowered - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*supplier.Stake) { - - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) - } - supplier.Stake = msg.Stake - - // Validate that the service configs maintain at least one service. - // Additional validation is done in `msg.ValidateBasic` above. - if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") - } - supplier.Services = msg.Services - - return nil -} diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index c93ecb201..f2dfc3ac5 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -39,6 +39,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcMethod: "UpdateParams", Skip: true, // skipped because authority gated }, + { + RpcMethod: "StakeSupplier", + Use: "stake-supplier [stake] [services]", + Short: "Send a stake-supplier tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, + }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/supplier/module/simulation.go b/x/supplier/module/simulation.go index 67a000511..5b9a3b82f 100644 --- a/x/supplier/module/simulation.go +++ b/x/supplier/module/simulation.go @@ -23,7 +23,11 @@ var ( ) const ( -// this line is used by starport scaffolding # simapp/module/const + opWeightMsgStakeSupplier = "op_weight_msg_stake_supplier" + // TODO: Determine the simulation weight value + defaultWeightMsgStakeSupplier 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 weightMsgStakeSupplier int + simState.AppParams.GetOrGenerate(opWeightMsgStakeSupplier, &weightMsgStakeSupplier, nil, + func(_ *rand.Rand) { + weightMsgStakeSupplier = defaultWeightMsgStakeSupplier + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgStakeSupplier, + suppliersimulation.SimulateMsgStakeSupplier(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( + opWeightMsgStakeSupplier, + defaultWeightMsgStakeSupplier, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/supplier/simulation/stake_supplier.go b/x/supplier/simulation/stake_supplier.go index 95fb7e8d6..a6f79739c 100644 --- a/x/supplier/simulation/stake_supplier.go +++ b/x/supplier/simulation/stake_supplier.go @@ -6,7 +6,6 @@ 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/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -19,13 +18,12 @@ func SimulateMsgStakeSupplier( 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) - stakeMsg := &types.MsgStakeSupplier{ + msg := &types.MsgStakeSupplier{ Address: simAccount.Address.String(), - // TODO: Update all stake message fields } // TODO: Handling the StakeSupplier simulation - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeSupplier simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "StakeSupplier simulation not implemented"), nil, nil } } diff --git a/x/supplier/types/codec.go b/x/supplier/types/codec.go index ac5526374..cdb58673f 100644 --- a/x/supplier/types/codec.go +++ b/x/supplier/types/codec.go @@ -8,6 +8,9 @@ import ( ) func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgStakeSupplier{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go index 7d1dbde07..033e3049e 100644 --- a/x/supplier/types/message_stake_supplier.go +++ b/x/supplier/types/message_stake_supplier.go @@ -1,81 +1,25 @@ package types import ( - sdkerrors "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgStakeSupplier = "stake_supplier" - -var _ sdk.Msg = (*MsgStakeSupplier)(nil) +var _ sdk.Msg = &MsgStakeSupplier{} -func NewMsgStakeSupplier( - address string, - stake types.Coin, - services []*sharedtypes.SupplierServiceConfig, -) *MsgStakeSupplier { +func NewMsgStakeSupplier(address string, stake sdk.Coin, services string) *MsgStakeSupplier { return &MsgStakeSupplier{ Address: address, - Stake: &stake, + Stake: stake, Services: services, } } -func (msg *MsgStakeSupplier) Route() string { - return RouterKey -} - -func (msg *MsgStakeSupplier) Type() string { - return TypeMsgStakeSupplier -} - -func (msg *MsgStakeSupplier) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeSupplier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgStakeSupplier) ValidateBasic() error { - // Validate the address _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid supplier address %s; (%v)", msg.Address, err) - } - - // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil supplier stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid supplier stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse supplier stake %v; (%v)", msg.Stake, err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", msg.Stake) - } - - // Validate the supplier service configs - if err := servicehelpers.ValidateSupplierServiceConfigs(msg.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) - } - return nil } diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go index 158fd8ff3..a76170d18 100644 --- a/x/supplier/types/message_stake_supplier_test.go +++ b/x/supplier/types/message_stake_supplier_test.go @@ -3,289 +3,30 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/stretchr/testify/require" ) -// TODO_CLEANUP: This test has a lot of copy-pasted code from test to test. -// It can be simplified by splitting it into smaller tests where the common -// fields don't need to be explicitly specified from test to test. func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { - - defaultServicesList := []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }} - tests := []struct { name string msg MsgStakeSupplier err error }{ - // address related tests { - name: "invalid address - nil stake", + name: "invalid address", msg: MsgStakeSupplier{ Address: "invalid_address", - // Stake explicitly nil - Services: defaultServicesList, - }, - err: ErrSupplierInvalidAddress, - }, - - // stake related tests - { - name: "valid address - nil stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - // Stake explicitly nil - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - }, { - name: "valid address - zero stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + err: sdkerrors.ErrInvalidAddress, }, { - name: "valid address - invalid stake denom", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, - - // service related tests - { - name: "valid service configs - multiple services", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - { - name: "invalid service configs - omitted", + name: "valid address", msg: MsgStakeSupplier{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - // Services: intentionally omitted }, - err: ErrSupplierInvalidServiceConfig, }, - { - name: "invalid service configs - empty", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{}, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service ID that's too long", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "123456790", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service Name that's too long", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service ID that contains invalid characters", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "12 45 !", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - missing url", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - // Url: intentionally omitted - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid url", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "I am not a valid URL", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - missing rpc type", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - // RpcType: intentionally omitted, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - // TODO_TEST: Need to add more tests around config types } - for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() From f2bb384adeff1bd81b7f8abc27f46f24acefabd6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 11:39:27 +0100 Subject: [PATCH 13/23] reconcile: stake supplier message --- api/poktroll/supplier/tx.pulsar.go | 273 ++++++++++++------ proto/poktroll/supplier/tx.proto | 22 +- .../keeper/msg_server_stake_supplier.go | 90 +++++- .../keeper/msg_server_stake_supplier_test.go | 39 ++- x/supplier/types/message_stake_supplier.go | 44 ++- .../types/message_stake_supplier_test.go | 265 ++++++++++++++++- 6 files changed, 596 insertions(+), 137 deletions(-) diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index ed51c87e8..35dcda3f0 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -9,6 +9,7 @@ import ( _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -872,6 +873,57 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var _ protoreflect.List = (*_MsgStakeSupplier_3_list)(nil) + +type _MsgStakeSupplier_3_list struct { + list *[]*shared.SupplierServiceConfig +} + +func (x *_MsgStakeSupplier_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgStakeSupplier_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgStakeSupplier_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.SupplierServiceConfig) + (*x.list)[i] = concreteValue +} + +func (x *_MsgStakeSupplier_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.SupplierServiceConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgStakeSupplier_3_list) AppendMutable() protoreflect.Value { + v := new(shared.SupplierServiceConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgStakeSupplier_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgStakeSupplier_3_list) NewElement() protoreflect.Value { + v := new(shared.SupplierServiceConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgStakeSupplier_3_list) IsValid() bool { + return x.list != nil +} + var ( md_MsgStakeSupplier protoreflect.MessageDescriptor fd_MsgStakeSupplier_address protoreflect.FieldDescriptor @@ -964,8 +1016,8 @@ func (x *fastReflection_MsgStakeSupplier) Range(f func(protoreflect.FieldDescrip return } } - if x.Services != "" { - value := protoreflect.ValueOfString(x.Services) + if len(x.Services) != 0 { + value := protoreflect.ValueOfList(&_MsgStakeSupplier_3_list{list: &x.Services}) if !f(fd_MsgStakeSupplier_services, value) { return } @@ -990,7 +1042,7 @@ func (x *fastReflection_MsgStakeSupplier) Has(fd protoreflect.FieldDescriptor) b case "poktroll.supplier.MsgStakeSupplier.stake": return x.Stake != nil case "poktroll.supplier.MsgStakeSupplier.services": - return x.Services != "" + return len(x.Services) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) @@ -1012,7 +1064,7 @@ func (x *fastReflection_MsgStakeSupplier) Clear(fd protoreflect.FieldDescriptor) case "poktroll.supplier.MsgStakeSupplier.stake": x.Stake = nil case "poktroll.supplier.MsgStakeSupplier.services": - x.Services = "" + x.Services = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) @@ -1036,8 +1088,11 @@ func (x *fastReflection_MsgStakeSupplier) Get(descriptor protoreflect.FieldDescr value := x.Stake return protoreflect.ValueOfMessage(value.ProtoReflect()) case "poktroll.supplier.MsgStakeSupplier.services": - value := x.Services - return protoreflect.ValueOfString(value) + if len(x.Services) == 0 { + return protoreflect.ValueOfList(&_MsgStakeSupplier_3_list{}) + } + listValue := &_MsgStakeSupplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) @@ -1063,7 +1118,9 @@ func (x *fastReflection_MsgStakeSupplier) Set(fd protoreflect.FieldDescriptor, v case "poktroll.supplier.MsgStakeSupplier.stake": x.Stake = value.Message().Interface().(*v1beta1.Coin) case "poktroll.supplier.MsgStakeSupplier.services": - x.Services = value.Interface().(string) + lv := value.List() + clv := lv.(*_MsgStakeSupplier_3_list) + x.Services = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) @@ -1089,10 +1146,14 @@ func (x *fastReflection_MsgStakeSupplier) Mutable(fd protoreflect.FieldDescripto x.Stake = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.services": + if x.Services == nil { + x.Services = []*shared.SupplierServiceConfig{} + } + value := &_MsgStakeSupplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(value) case "poktroll.supplier.MsgStakeSupplier.address": panic(fmt.Errorf("field address of message poktroll.supplier.MsgStakeSupplier is not mutable")) - case "poktroll.supplier.MsgStakeSupplier.services": - panic(fmt.Errorf("field services of message poktroll.supplier.MsgStakeSupplier is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) @@ -1112,7 +1173,8 @@ func (x *fastReflection_MsgStakeSupplier) NewField(fd protoreflect.FieldDescript m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.supplier.MsgStakeSupplier.services": - return protoreflect.ValueOfString("") + list := []*shared.SupplierServiceConfig{} + return protoreflect.ValueOfList(&_MsgStakeSupplier_3_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) @@ -1190,9 +1252,11 @@ func (x *fastReflection_MsgStakeSupplier) ProtoMethods() *protoiface.Methods { l = options.Size(x.Stake) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Services) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.Services) > 0 { + for _, e := range x.Services { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1224,11 +1288,20 @@ func (x *fastReflection_MsgStakeSupplier) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } if len(x.Services) > 0 { - i -= len(x.Services) - copy(dAtA[i:], x.Services) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Services))) - i-- - dAtA[i] = 0x1a + for iNdEx := len(x.Services) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Services[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] = 0x1a + } } if x.Stake != nil { encoded, err := options.Marshal(x.Stake) @@ -1372,7 +1445,7 @@ func (x *fastReflection_MsgStakeSupplier) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1382,23 +1455,25 @@ func (x *fastReflection_MsgStakeSupplier) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Services = string(dAtA[iNdEx:postIndex]) + x.Services = append(x.Services, &shared.SupplierServiceConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Services[len(x.Services)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1883,9 +1958,9 @@ type MsgStakeSupplier 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"` - Services string `protobuf:"bytes,3,opt,name=services,proto3" json:"services,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + Services []*shared.SupplierServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The list of services this supplier is staked to provide service for } func (x *MsgStakeSupplier) Reset() { @@ -1922,11 +1997,11 @@ func (x *MsgStakeSupplier) GetStake() *v1beta1.Coin { return nil } -func (x *MsgStakeSupplier) GetServices() string { +func (x *MsgStakeSupplier) GetServices() []*shared.SupplierServiceConfig { if x != nil { return x.Services } - return "" + return nil } type MsgStakeSupplierResponse struct { @@ -1966,60 +2041,66 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 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, 0x1e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, + 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, 0xbf, 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, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x8d, 0x01, 0x0a, 0x10, 0x4d, 0x73, - 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x12, - 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, - 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, - 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, 0x0a, - 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, - 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x23, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 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, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xc9, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, + 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xcf, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, - 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, + 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2036,25 +2117,27 @@ func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse - (*MsgStakeSupplier)(nil), // 2: poktroll.supplier.MsgStakeSupplier - (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse - (*Params)(nil), // 4: poktroll.supplier.Params - (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin + (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse + (*MsgStakeSupplier)(nil), // 2: poktroll.supplier.MsgStakeSupplier + (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse + (*Params)(nil), // 4: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin + (*shared.SupplierServiceConfig)(nil), // 6: poktroll.shared.SupplierServiceConfig } var file_poktroll_supplier_tx_proto_depIdxs = []int32{ 4, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params 5, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin - 0, // 2: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams - 2, // 3: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier - 1, // 4: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse - 3, // 5: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse - 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 + 6, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier + 1, // 5: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 6: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_supplier_tx_proto_init() } diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index df81f2a54..4b1eab4cf 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -6,30 +6,31 @@ import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "poktroll/supplier/params.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "poktroll/supplier/params.proto"; +import "poktroll/shared/service.proto"; option go_package = "github.com/pokt-network/poktroll/x/supplier/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 StakeSupplier (MsgStakeSupplier) returns (MsgStakeSupplierResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/supplier/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]; } @@ -39,10 +40,11 @@ message MsgUpdateParams { message MsgUpdateParamsResponse {} message MsgStakeSupplier { - option (cosmos.msg.v1.signer) = "address"; - string address = 1; - cosmos.base.v1beta1.Coin stake = 2 [(gogoproto.nullable) = false]; - string services = 3; + option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + repeated poktroll.shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for } message MsgStakeSupplierResponse {} diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index 812efdbef..d99447da1 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -2,16 +2,102 @@ package keeper import ( "context" + "fmt" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" ) func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message - _ = ctx + logger := k.Logger().With("method", "StakeSupplier") + logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) + return nil, err + } + + // Check if the supplier already exists or not + var err error + var coinsToDelegate sdk.Coin + supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) + if !isSupplierFound { + logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) + supplier = k.createSupplier(ctx, msg) + coinsToDelegate = *msg.Stake + } else { + logger.Info(fmt.Sprintf("Supplier found. Updating supplier for address %s", msg.Address)) + currSupplierStake := *supplier.Stake + if err = k.updateSupplier(ctx, &supplier, msg); err != nil { + return nil, err + } + coinsToDelegate = (*msg.Stake).Sub(currSupplierStake) + } + + // Retrieve the address of the supplier + supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? + // Send the coins from the supplier to the staked supplier pool + err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, supplierAddress, 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, supplierAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Supplier in the store + k.SetSupplier(ctx, supplier) + logger.Info(fmt.Sprintf("Successfully updated supplier stake for supplier: %+v", supplier)) return &types.MsgStakeSupplierResponse{}, nil } + +func (k msgServer) createSupplier( + ctx sdk.Context, + msg *types.MsgStakeSupplier, +) sharedtypes.Supplier { + return sharedtypes.Supplier{ + Address: msg.Address, + Stake: msg.Stake, + Services: msg.Services, + } +} + +func (k msgServer) updateSupplier( + ctx sdk.Context, + supplier *sharedtypes.Supplier, + msg *types.MsgStakeSupplier, +) error { + // Checks if the the msg address is the same as the current owner + if msg.Address != supplier.Address { + return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) + } + + // Validate that the stake is not being lowered + if msg.Stake == nil { + return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") + } + if msg.Stake.IsLTE(*supplier.Stake) { + + return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) + } + supplier.Stake = msg.Stake + + // Validate that the service configs maintain at least one service. + // Additional validation is done in `msg.ValidateBasic` above. + if len(msg.Services) == 0 { + return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") + } + supplier.Services = msg.Services + + return nil +} diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index bbc74cd6e..c97ee5558 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -14,8 +15,8 @@ import ( ) func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) wctx := sdk.WrapSDKContext(ctx) // Generate an address for the supplier @@ -28,7 +29,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { // Prepare the stakeMsg stakeMsg := &types.MsgStakeSupplier{ Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{ @@ -62,7 +63,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { // Prepare an updated supplier with a higher stake and a different URL for the service updateMsg := &types.MsgStakeSupplier{ Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(200)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{ @@ -92,16 +93,15 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { } func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) supplierAddr := sample.AccAddress() // Prepare the supplier stake message stakeMsg := &types.MsgStakeSupplier{ Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{ @@ -119,13 +119,13 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) } // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) + _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Prepare the supplier stake message without any service endpoints updateStakeMsg := &types.MsgStakeSupplier{ Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{Id: "svcId"}, @@ -135,7 +135,7 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) } // Fail updating the supplier when the list of service endpoints is empty - _, err = srv.StakeSupplier(wctx, updateStakeMsg) + _, err = srv.StakeSupplier(ctx, updateStakeMsg) require.Error(t, err) // Verify the supplierFound still exists and is staked for svc1 @@ -150,7 +150,7 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) // Prepare the supplier stake message with an invalid service ID updateStakeMsg = &types.MsgStakeSupplier{ Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, @@ -159,7 +159,7 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) } // Fail updating the supplier when the list of services is empty - _, err = srv.StakeSupplier(wctx, updateStakeMsg) + _, err = srv.StakeSupplier(ctx, updateStakeMsg) require.Error(t, err) // Verify the supplier still exists and is staked for svc1 @@ -173,15 +173,14 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) } func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) // Prepare the supplier addr := sample.AccAddress() stakeMsg := &types.MsgStakeSupplier{ Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{ @@ -199,7 +198,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { } // Stake the supplier & verify that the supplier exists - _, err := srv.StakeSupplier(wctx, stakeMsg) + _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) _, isSupplierFound := k.GetSupplier(ctx, addr) require.True(t, isSupplierFound) @@ -207,7 +206,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { // Prepare an updated supplier with a lower stake updateMsg := &types.MsgStakeSupplier{ Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(50)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{ @@ -225,7 +224,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { } // Verify that it fails - _, err = srv.StakeSupplier(wctx, updateMsg) + _, err = srv.StakeSupplier(ctx, updateMsg) require.Error(t, err) // Verify that the supplier stake is unchanged diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go index 033e3049e..44589187d 100644 --- a/x/supplier/types/message_stake_supplier.go +++ b/x/supplier/types/message_stake_supplier.go @@ -1,25 +1,57 @@ package types import ( - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) +const TypeMsgStakeSupplier = "stake_supplier" + var _ sdk.Msg = &MsgStakeSupplier{} -func NewMsgStakeSupplier(address string, stake sdk.Coin, services string) *MsgStakeSupplier { +func NewMsgStakeSupplier( + address string, + stake sdk.Coin, + services []*sharedtypes.SupplierServiceConfig, +) *MsgStakeSupplier { return &MsgStakeSupplier{ Address: address, - Stake: stake, + Stake: &stake, Services: services, } } func (msg *MsgStakeSupplier) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) + // Validate the address + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return ErrSupplierInvalidAddress.Wrapf("invalid supplier address %s; (%v)", msg.Address, err) + } + + // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code + // Validate the stake amount + if msg.Stake == nil { + return ErrSupplierInvalidStake.Wrap("nil supplier stake") + } + stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) + if !stake.IsValid() { + return ErrSupplierInvalidStake.Wrapf("invalid supplier stake %v; (%v)", msg.Stake, stake.Validate()) + } if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) + return ErrSupplierInvalidStake.Wrapf("cannot parse supplier stake %v; (%v)", msg.Stake, err) } + if stake.IsZero() || stake.IsNegative() { + return ErrSupplierInvalidStake.Wrapf("invalid stake amount for supplier: %v <= 0", msg.Stake) + } + if stake.Denom != "upokt" { + return ErrSupplierInvalidStake.Wrapf("invalid stake amount denom for supplier %v", msg.Stake) + } + + // Validate the supplier service configs + if err := servicehelpers.ValidateSupplierServiceConfigs(msg.Services); err != nil { + return ErrSupplierInvalidServiceConfig.Wrapf(err.Error()) + } + return nil } diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go index a76170d18..76798c98a 100644 --- a/x/supplier/types/message_stake_supplier_test.go +++ b/x/supplier/types/message_stake_supplier_test.go @@ -3,30 +3,287 @@ package types import ( "testing" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/stretchr/testify/require" ) func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { + defaultServicesList := []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }} + tests := []struct { name string msg MsgStakeSupplier err error }{ + // address related tests { - name: "invalid address", + name: "invalid address - nil stake", msg: MsgStakeSupplier{ Address: "invalid_address", + // Stake explicitly nil + Services: defaultServicesList, + }, + err: ErrSupplierInvalidAddress, + }, + + // stake related tests + { + name: "valid address - nil stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + // Stake explicitly nil + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - valid stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: defaultServicesList, + }, + }, { + name: "valid address - zero stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + Services: defaultServicesList, }, - err: sdkerrors.ErrInvalidAddress, + err: ErrSupplierInvalidStake, }, { - name: "valid address", + name: "valid address - negative stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - invalid stake denom", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - invalid stake missing denom", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, + + // service related tests + { + name: "valid service configs - multiple services", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + { + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + }, + { + name: "invalid service configs - omitted", msg: MsgStakeSupplier{ Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + // Services: intentionally omitted }, + err: ErrSupplierInvalidServiceConfig, }, + { + name: "invalid service configs - empty", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{}, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid service ID that's too long", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "123456790", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid service Name that's too long", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "123", + Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid service ID that contains invalid characters", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "12 45 !", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - missing url", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + Name: "name", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + // Url: intentionally omitted + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid url", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + Name: "name", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "I am not a valid URL", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - missing rpc type", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + Name: "name", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + // RpcType: intentionally omitted, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + // TODO_TEST: Need to add more tests around config types } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() From d82daac887be3f68b4da3ec97466480e1d7bd8ca Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 11:44:24 +0100 Subject: [PATCH 14/23] reconcile: mock bank keeper --- Makefile | 85 +++++++++++++--------------- testutil/keeper/supplier.go | 9 ++- x/supplier/types/expected_keepers.go | 6 +- 3 files changed, 51 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 679e200ff..1faaece02 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ .SILENT: -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 +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 #################### @@ -16,6 +15,7 @@ install_ci_deps: ## Installs `mockgen` and other go tools go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version go install golang.org/x/tools/cmd/goimports@latest + go install github.com/mikefarah/yq/v4@latest ######################## ### Makefile Helpers ### @@ -50,8 +50,8 @@ check_go_version: MAJOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 1) && \ MINOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 2) && \ \ - if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -ge 21 ] || [ "$$MINOR_VERSION" -le 18 ] ; then \ - echo "Invalid Go version. Expected 1.19.x or 1.20.x but found $$GO_VERSION"; \ + if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -le 20 ] ; then \ + echo "Invalid Go version. Expected 1.21.x or newer but found $$GO_VERSION"; \ exit 1; \ fi @@ -141,6 +141,13 @@ proto_regen: ## Delete existing protobuf artifacts and regenerate them find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm ignite generate proto-go --yes +.PHONY: proto_clean_pulsar +proto_clean_pulsar: ## TODO: explain... + @find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' + find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm + ignite generate proto-go --yes + find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + ####################### ### Docker Helpers ### ####################### @@ -164,16 +171,27 @@ localnet_up: ## Starts localnet .PHONY: localnet_down localnet_down: ## Delete resources created by localnet tilt down - kubectl delete secret celestia-secret || exit 1 .PHONY: localnet_regenesis -localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file +localnet_regenesis: ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring - ignite chain init - mkdir -p $(POKTROLLD_HOME)/config/ - cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) - cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ - cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ +# NB: Currently the stake => power calculation is constant; however, cosmos-sdk +# intends to make this parameterizable in the future. + @echo "Initializing chain..." + @set -e ;\ + ignite chain init ;\ + mkdir -p $(POKTROLLD_HOME)/config/ ;\ + cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) ;\ + 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) ;\ + 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 ;\ + cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ ;\ + # TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state. # cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml @@ -196,7 +214,7 @@ go_imports: check_go_version ## Run goimports on all go files ############# .PHONY: test_e2e -test_e2e: acc_initialize_pubkeys_warn_message ## Run all E2E tests +test_e2e: ## Run all E2E tests export POCKET_NODE=$(POCKET_NODE) && \ export APPGATE_SERVER=$(APPGATE_SERVER) && \ POKTROLLD_HOME=../../$(POKTROLLD_HOME) && \ @@ -225,12 +243,12 @@ itest: check_go_version ## Run tests iteratively (see usage for more) .PHONY: go_mockgen 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/application/types/ + # go generate ./x/gateway/types/ go generate ./x/supplier/types/ - go generate ./x/session/types/ + # go generate ./x/session/types/ go generate ./x/service/types/ - go generate ./x/tokenomics/types/ + # go generate ./x/tokenomics/types/ go generate ./pkg/client/interface.go go generate ./pkg/miner/interface.go go generate ./pkg/relayer/interface.go @@ -251,7 +269,7 @@ go_develop: proto_regen go_mockgen ## Generate protos and mocks go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests .PHONY: load_test_simple -load_test_simple: ## Runs the simpliest load test through the whole stack (appgate -> relayminer -> anvil) +load_test_simple: ## Runs the simplest load test through the whole stack (appgate -> relayminer -> anvil) k6 run load-testing/tests/appGateServerEtherium.js ############# @@ -358,6 +376,7 @@ 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 @@ -517,32 +536,6 @@ 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 ### ############## @@ -670,4 +663,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) \ No newline at end of file + act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go index e848b5e84..ba9cb9b46 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.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" + "github.com/pokt-network/poktroll/testutil/supplier/mocks" "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -35,12 +37,17 @@ func SupplierKeeper(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/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go index 4a50d01a9..6680b26e0 100644 --- a/x/supplier/types/expected_keepers.go +++ b/x/supplier/types/expected_keepers.go @@ -1,3 +1,5 @@ +//go:generate mockgen -destination ../../../testutil/supplier/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper + package types import ( @@ -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 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. From 4d34fd84321a44cc42131c4ad35d671a9e8ce249 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 11:46:22 +0100 Subject: [PATCH 15/23] scaffold: message unstake-supplier --module supplier --signer address --- api/poktroll/supplier/tx.pulsar.go | 949 +++++++++++++++++- proto/poktroll/supplier/tx.proto | 25 +- .../keeper/msg_server_unstake_supplier.go | 41 +- x/supplier/module/autocli.go | 6 + x/supplier/module/simulation.go | 23 + x/supplier/simulation/unstake_supplier.go | 3 +- x/supplier/types/codec.go | 3 + x/supplier/types/message_unstake_supplier.go | 30 +- .../types/message_unstake_supplier_test.go | 10 +- 9 files changed, 972 insertions(+), 118 deletions(-) diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index 35dcda3f0..b621f6d0f 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -1866,6 +1866,782 @@ func (x *fastReflection_MsgStakeSupplierResponse) ProtoMethods() *protoiface.Met } } +var ( + md_MsgUnstakeSupplier protoreflect.MessageDescriptor + fd_MsgUnstakeSupplier_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUnstakeSupplier = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUnstakeSupplier") + fd_MsgUnstakeSupplier_address = md_MsgUnstakeSupplier.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeSupplier)(nil) + +type fastReflection_MsgUnstakeSupplier MsgUnstakeSupplier + +func (x *MsgUnstakeSupplier) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplier)(x) +} + +func (x *MsgUnstakeSupplier) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_MsgUnstakeSupplier_messageType fastReflection_MsgUnstakeSupplier_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeSupplier_messageType{} + +type fastReflection_MsgUnstakeSupplier_messageType struct{} + +func (x fastReflection_MsgUnstakeSupplier_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplier)(nil) +} +func (x fastReflection_MsgUnstakeSupplier_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplier) +} +func (x fastReflection_MsgUnstakeSupplier_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplier +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeSupplier) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplier +} + +// 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_MsgUnstakeSupplier) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeSupplier_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeSupplier) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplier) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeSupplier) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeSupplier)(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_MsgUnstakeSupplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgUnstakeSupplier_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_MsgUnstakeSupplier) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier 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_MsgUnstakeSupplier) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier 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_MsgUnstakeSupplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier 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_MsgUnstakeSupplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier 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_MsgUnstakeSupplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + panic(fmt.Errorf("field address of message poktroll.supplier.MsgUnstakeSupplier is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier 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_MsgUnstakeSupplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier 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_MsgUnstakeSupplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUnstakeSupplier", 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_MsgUnstakeSupplier) 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_MsgUnstakeSupplier) 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_MsgUnstakeSupplier) 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_MsgUnstakeSupplier) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeSupplier) + 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().(*MsgUnstakeSupplier) + 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().(*MsgUnstakeSupplier) + 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: MsgUnstakeSupplier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeSupplier: 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_MsgUnstakeSupplierResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUnstakeSupplierResponse = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUnstakeSupplierResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeSupplierResponse)(nil) + +type fastReflection_MsgUnstakeSupplierResponse MsgUnstakeSupplierResponse + +func (x *MsgUnstakeSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplierResponse)(x) +} + +func (x *MsgUnstakeSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_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_MsgUnstakeSupplierResponse_messageType fastReflection_MsgUnstakeSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeSupplierResponse_messageType{} + +type fastReflection_MsgUnstakeSupplierResponse_messageType struct{} + +func (x fastReflection_MsgUnstakeSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplierResponse)(nil) +} +func (x fastReflection_MsgUnstakeSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplierResponse) +} +func (x fastReflection_MsgUnstakeSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplierResponse +} + +// 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_MsgUnstakeSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeSupplierResponse) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeSupplierResponse)(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_MsgUnstakeSupplierResponse) 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_MsgUnstakeSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse 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_MsgUnstakeSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse 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_MsgUnstakeSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse 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_MsgUnstakeSupplierResponse) 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.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse 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_MsgUnstakeSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse 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_MsgUnstakeSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse 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_MsgUnstakeSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUnstakeSupplierResponse", 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_MsgUnstakeSupplierResponse) 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_MsgUnstakeSupplierResponse) 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_MsgUnstakeSupplierResponse) 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_MsgUnstakeSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeSupplierResponse) + 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().(*MsgUnstakeSupplierResponse) + 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().(*MsgUnstakeSupplierResponse) + 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: MsgUnstakeSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeSupplierResponse: 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 @@ -2030,6 +2806,67 @@ func (*MsgStakeSupplierResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{3} } +type MsgUnstakeSupplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *MsgUnstakeSupplier) Reset() { + *x = MsgUnstakeSupplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeSupplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeSupplier) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeSupplier.ProtoReflect.Descriptor instead. +func (*MsgUnstakeSupplier) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgUnstakeSupplier) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type MsgUnstakeSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUnstakeSupplierResponse) Reset() { + *x = MsgUnstakeSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeSupplierResponse) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeSupplierResponse.ProtoReflect.Descriptor instead. +func (*MsgUnstakeSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{5} +} + var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor var file_poktroll_supplier_tx_proto_rawDesc = []byte{ @@ -2076,31 +2913,43 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xcf, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x22, 0x3c, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x1c, + 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x02, 0x0a, + 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, - 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, - 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, - 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, + 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, + 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2115,26 +2964,30 @@ func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { return file_poktroll_supplier_tx_proto_rawDescData } -var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse (*MsgStakeSupplier)(nil), // 2: poktroll.supplier.MsgStakeSupplier (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse - (*Params)(nil), // 4: poktroll.supplier.Params - (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin - (*shared.SupplierServiceConfig)(nil), // 6: poktroll.shared.SupplierServiceConfig + (*MsgUnstakeSupplier)(nil), // 4: poktroll.supplier.MsgUnstakeSupplier + (*MsgUnstakeSupplierResponse)(nil), // 5: poktroll.supplier.MsgUnstakeSupplierResponse + (*Params)(nil), // 6: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*shared.SupplierServiceConfig)(nil), // 8: poktroll.shared.SupplierServiceConfig } var file_poktroll_supplier_tx_proto_depIdxs = []int32{ - 4, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params - 5, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin - 6, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 6, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params + 7, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin + 8, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier - 1, // 5: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse - 3, // 6: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type + 4, // 5: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier + 1, // 6: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 7: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 5, // 8: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -2195,6 +3048,30 @@ func file_poktroll_supplier_tx_proto_init() { return nil } } + file_poktroll_supplier_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeSupplier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeSupplierResponse); 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{ @@ -2202,7 +3079,7 @@ func file_poktroll_supplier_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_supplier_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 4b1eab4cf..3249fbbca 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -15,22 +15,23 @@ option go_package = "github.com/pokt-network/poktroll/x/supplier/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 StakeSupplier (MsgStakeSupplier) returns (MsgStakeSupplierResponse); + rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); + rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/supplier/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,11 +42,17 @@ message MsgUpdateParamsResponse {} message MsgStakeSupplier { option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) repeated poktroll.shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for } message MsgStakeSupplierResponse {} +message MsgUnstakeSupplier { + option (cosmos.msg.v1.signer) = "address"; + string address = 1; +} + +message MsgUnstakeSupplierResponse {} + diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go index 79f86db3f..82d447346 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ b/x/supplier/keeper/msg_server_unstake_supplier.go @@ -2,51 +2,16 @@ package keeper import ( "context" - "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/supplier/types" ) -// TODO(#73): Determine if an application needs an unbonding period after unstaking. -func (k msgServer) UnstakeSupplier( - goCtx context.Context, - msg *types.MsgUnstakeSupplier, -) (*types.MsgUnstakeSupplierResponse, error) { +func (k msgServer) UnstakeSupplier(goCtx context.Context, msg *types.MsgUnstakeSupplier) (*types.MsgUnstakeSupplierResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "UnstakeSupplier") - logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the supplier already exists or not - supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) - if !isSupplierFound { - logger.Info(fmt.Sprintf("Supplier not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrSupplierNotFound - } - logger.Info(fmt.Sprintf("Supplier found. Unstaking supplier for address %s", msg.Address)) - - // Retrieve the address of the supplier - supplierAddress, 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 supplier pool back to the supplier - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", supplier.Stake, supplierAddress, types.ModuleName, err)) - return nil, err - } + // TODO: Handling the message + _ = ctx - // Update the Supplier in the store - k.RemoveSupplier(ctx, supplierAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the supplier: %+v", supplier)) return &types.MsgUnstakeSupplierResponse{}, nil } diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index f2dfc3ac5..ec75e7031 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -45,6 +45,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Send a stake-supplier tx", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, }, + { + RpcMethod: "UnstakeSupplier", + Use: "unstake-supplier", + Short: "Send a unstake-supplier tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/supplier/module/simulation.go b/x/supplier/module/simulation.go index 5b9a3b82f..0d735d61f 100644 --- a/x/supplier/module/simulation.go +++ b/x/supplier/module/simulation.go @@ -27,6 +27,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgStakeSupplier int = 100 + opWeightMsgUnstakeSupplier = "op_weight_msg_unstake_supplier" + // TODO: Determine the simulation weight value + defaultWeightMsgUnstakeSupplier int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -66,6 +70,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgUnstakeSupplier int + simState.AppParams.GetOrGenerate(opWeightMsgUnstakeSupplier, &weightMsgUnstakeSupplier, nil, + func(_ *rand.Rand) { + weightMsgUnstakeSupplier = defaultWeightMsgUnstakeSupplier + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnstakeSupplier, + suppliersimulation.SimulateMsgUnstakeSupplier(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( + opWeightMsgUnstakeSupplier, + defaultWeightMsgUnstakeSupplier, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/supplier/simulation/unstake_supplier.go b/x/supplier/simulation/unstake_supplier.go index 3955b25db..377b74176 100644 --- a/x/supplier/simulation/unstake_supplier.go +++ b/x/supplier/simulation/unstake_supplier.go @@ -6,7 +6,6 @@ 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/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -25,6 +24,6 @@ func SimulateMsgUnstakeSupplier( // TODO: Handling the UnstakeSupplier simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeSupplier simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UnstakeSupplier simulation not implemented"), nil, nil } } diff --git a/x/supplier/types/codec.go b/x/supplier/types/codec.go index cdb58673f..9ecbe1202 100644 --- a/x/supplier/types/codec.go +++ b/x/supplier/types/codec.go @@ -11,6 +11,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgStakeSupplier{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnstakeSupplier{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go index 884c21c36..4d07746ba 100644 --- a/x/supplier/types/message_unstake_supplier.go +++ b/x/supplier/types/message_unstake_supplier.go @@ -1,13 +1,12 @@ package types import ( - sdkerrors "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgUnstakeSupplier = "unstake_supplier" - -var _ sdk.Msg = (*MsgUnstakeSupplier)(nil) +var _ sdk.Msg = &MsgUnstakeSupplier{} func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { return &MsgUnstakeSupplier{ @@ -15,31 +14,10 @@ func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { } } -func (msg *MsgUnstakeSupplier) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeSupplier) Type() string { - return TypeMsgUnstakeSupplier -} - -func (msg *MsgUnstakeSupplier) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeSupplier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgUnstakeSupplier) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid address address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) } return nil } diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go index b447397ed..c9845c927 100644 --- a/x/supplier/types/message_unstake_supplier_test.go +++ b/x/supplier/types/message_unstake_supplier_test.go @@ -3,9 +3,9 @@ package types import ( "testing" - "github.com/stretchr/testify/require" - + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/pokt-network/poktroll/testutil/sample" + "github.com/stretchr/testify/require" ) func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { @@ -19,11 +19,7 @@ func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { msg: MsgUnstakeSupplier{ Address: "invalid_address", }, - err: ErrSupplierInvalidAddress, - }, { - name: "missing address", - msg: MsgUnstakeSupplier{}, - err: ErrSupplierInvalidAddress, + err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgUnstakeSupplier{ From 5ba7353e2f1b7eba3a767f076735638e97edd3b1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 11:53:34 +0100 Subject: [PATCH 16/23] reconcile: unstake supplier message --- api/poktroll/supplier/tx.pulsar.go | 78 ++++++++++--------- proto/poktroll/supplier/tx.proto | 2 +- .../keeper/msg_server_unstake_supplier.go | 41 +++++++++- .../msg_server_unstake_supplier_test.go | 19 +++-- x/supplier/types/message_unstake_supplier.go | 9 +-- .../types/message_unstake_supplier_test.go | 10 ++- 6 files changed, 99 insertions(+), 60 deletions(-) diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index b621f6d0f..362a13a3b 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -2811,7 +2811,7 @@ type MsgUnstakeSupplier 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 supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding } func (x *MsgUnstakeSupplier) Reset() { @@ -2913,43 +2913,45 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x3c, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x1c, - 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x02, 0x0a, - 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, - 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, - 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, - 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x56, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, + 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, + 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, + 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, + 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, + 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 3249fbbca..79ed6f5c3 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -51,7 +51,7 @@ message MsgStakeSupplierResponse {} message MsgUnstakeSupplier { option (cosmos.msg.v1.signer) = "address"; - string address = 1; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding } message MsgUnstakeSupplierResponse {} diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go index 82d447346..41f3de736 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ b/x/supplier/keeper/msg_server_unstake_supplier.go @@ -2,16 +2,51 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) UnstakeSupplier(goCtx context.Context, msg *types.MsgUnstakeSupplier) (*types.MsgUnstakeSupplierResponse, error) { +func (k msgServer) UnstakeSupplier( + goCtx context.Context, + msg *types.MsgUnstakeSupplier, +) (*types.MsgUnstakeSupplierResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message - _ = ctx + logger := k.Logger().With("method", "UnstakeSupplier") + logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // Check if the supplier already exists or not + supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) + if !isSupplierFound { + logger.Info(fmt.Sprintf("Supplier not found. Cannot unstake address %s", msg.Address)) + return nil, types.ErrSupplierNotFound + } + logger.Info(fmt.Sprintf("Supplier found. Unstaking supplier for address %s", msg.Address)) + // Retrieve the address of the supplier + supplierAddress, 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 supplier pool back to the supplier + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", supplier.Stake, supplierAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Supplier in the store + k.RemoveSupplier(ctx, supplierAddress.String()) + logger.Info(fmt.Sprintf("Successfully removed the supplier: %+v", supplier)) return &types.MsgUnstakeSupplierResponse{}, nil + } diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go index 2999a5e3c..c3b9d9144 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ b/x/supplier/keeper/msg_server_unstake_supplier_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -14,9 +15,8 @@ import ( ) func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) // Generate an address for the supplier addr := sample.AccAddress() @@ -26,7 +26,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { require.False(t, isSupplierFound) // Prepare the supplier - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeSupplier{ Address: addr, Stake: &initialStake, @@ -47,7 +47,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { } // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) + _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Verify that the supplier exists @@ -59,7 +59,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { // Unstake the supplier unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} - _, err = srv.UnstakeSupplier(wctx, unstakeMsg) + _, err = srv.UnstakeSupplier(ctx, unstakeMsg) require.NoError(t, err) // Make sure the supplier can no longer be found after unstaking @@ -68,9 +68,8 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { } func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) // Generate an address for the supplier addr := sample.AccAddress() @@ -81,7 +80,7 @@ func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { // Unstake the supplier unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} - _, err := srv.UnstakeSupplier(wctx, unstakeMsg) + _, err := srv.UnstakeSupplier(ctx, unstakeMsg) require.Error(t, err) require.ErrorIs(t, err, types.ErrSupplierNotFound) diff --git a/x/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go index 4d07746ba..4a5226ee5 100644 --- a/x/supplier/types/message_unstake_supplier.go +++ b/x/supplier/types/message_unstake_supplier.go @@ -1,11 +1,11 @@ package types import ( - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +const TypeMsgUnstakeSupplier = "unstake_supplier" + var _ sdk.Msg = &MsgUnstakeSupplier{} func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { @@ -15,9 +15,8 @@ func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { } func (msg *MsgUnstakeSupplier) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return ErrSupplierInvalidAddress.Wrapf("invalid address address (%s)", err) } return nil } diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go index c9845c927..b447397ed 100644 --- a/x/supplier/types/message_unstake_supplier_test.go +++ b/x/supplier/types/message_unstake_supplier_test.go @@ -3,9 +3,9 @@ package types import ( "testing" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/pokt-network/poktroll/testutil/sample" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { @@ -19,7 +19,11 @@ func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { msg: MsgUnstakeSupplier{ Address: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: ErrSupplierInvalidAddress, + }, { + name: "missing address", + msg: MsgUnstakeSupplier{}, + err: ErrSupplierInvalidAddress, }, { name: "valid address", msg: MsgUnstakeSupplier{ From 0b8245b25c4166cef2cb813ce98420439da72999 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 11:58:42 +0100 Subject: [PATCH 17/23] reconcile: supplier CLI configs --- x/supplier/config/errors.go | 15 ++ x/supplier/config/supplier_configs_reader.go | 192 ++++++++++++++++++ .../config/supplier_configs_reader_test.go | 1 + 3 files changed, 208 insertions(+) create mode 100644 x/supplier/config/errors.go create mode 100644 x/supplier/config/supplier_configs_reader.go create mode 100644 x/supplier/config/supplier_configs_reader_test.go diff --git a/x/supplier/config/errors.go b/x/supplier/config/errors.go new file mode 100644 index 000000000..6a0194a75 --- /dev/null +++ b/x/supplier/config/errors.go @@ -0,0 +1,15 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "supplierconfig" + ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") + ErrSupplierConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in supplier config") + ErrSupplierConfigNoEndpoints = sdkerrors.Register(codespace, 3, "no endpoints defined for serviceId in supplier config") + ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(codespace, 4, "invalid endpoint config in supplier config") + ErrSupplierConfigInvalidRPCType = sdkerrors.Register(codespace, 5, "invalid rpc type in supplier config") + ErrSupplierConfigInvalidURL = sdkerrors.Register(codespace, 6, "invalid endpoint url in supplier config") + ErrSupplierConfigEmptyContent = sdkerrors.Register(codespace, 7, "empty supplier config content") + ErrSupplierConfigInvalidStake = sdkerrors.Register(codespace, 8, "invalid stake amount in supplier config") +) diff --git a/x/supplier/config/supplier_configs_reader.go b/x/supplier/config/supplier_configs_reader.go new file mode 100644 index 000000000..de9549553 --- /dev/null +++ b/x/supplier/config/supplier_configs_reader.go @@ -0,0 +1,192 @@ +package config + +import ( + "net/url" + + sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" + + sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// YAMLStakeConfig is the structure describing the supplier stake config file +type YAMLStakeConfig struct { + StakeAmount string `yaml:"stake_amount"` + Services []*YAMLStakeService `yaml:"services"` +} + +// YAMLStakeService is the structure describing a single service stake entry in the stake config file +type YAMLStakeService struct { + ServiceId string `yaml:"service_id"` + Endpoints []YAMLServiceEndpoint `yaml:"endpoints"` +} + +// YAMLServiceEndpoint is the structure describing a single service endpoint in the stake config file +type YAMLServiceEndpoint struct { + Url string `yaml:"url"` + RPCType string `yaml:"rpc_type"` + Config map[string]string `yaml:"config,omitempty"` +} + +// SupplierStakeConfig is the structure describing the parsed supplier stake config +type SupplierStakeConfig struct { + StakeAmount sdk.Coin + Services []*sharedtypes.SupplierServiceConfig +} + +// ParseSupplierServiceConfig parses the stake config file into a SupplierServiceConfig +func ParseSupplierConfigs(configContent []byte) (*SupplierStakeConfig, error) { + var stakeConfig *YAMLStakeConfig + + if len(configContent) == 0 { + return nil, ErrSupplierConfigEmptyContent + } + + // Unmarshal the stake config file into a stakeConfig + if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { + return nil, ErrSupplierConfigUnmarshalYAML.Wrapf("%s", err) + } + + // Validate the stake amount + if len(stakeConfig.StakeAmount) == 0 { + return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be empty") + } + + stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) + if err != nil { + return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) + } + + if err := stakeAmount.Validate(); err != nil { + return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) + } + + if stakeAmount.IsZero() { + return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be zero") + } + + if stakeAmount.Denom != "upokt" { + return nil, ErrSupplierConfigInvalidStake.Wrapf( + "invalid stake denom, expecting: upokt, got: %s", + stakeAmount.Denom, + ) + } + + // Validate the services + if stakeConfig.Services == nil || len(stakeConfig.Services) == 0 { + return nil, ErrSupplierConfigInvalidServiceId.Wrap("serviceIds cannot be empty") + } + + // Prepare the supplierServiceConfig + supplierServiceConfig := make([]*sharedtypes.SupplierServiceConfig, 0, len(stakeConfig.Services)) + + // Populate the services slice + for _, svc := range stakeConfig.Services { + // Validate the serviceId + if !sharedhelpers.IsValidServiceId(svc.ServiceId) { + return nil, ErrSupplierConfigInvalidServiceId.Wrapf("%s", svc.ServiceId) + } + + if len(svc.Endpoints) == 0 { + return nil, ErrSupplierConfigNoEndpoints.Wrapf("%s", svc.ServiceId) + } + + // Create a supplied service config with the serviceId + service := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{Id: svc.ServiceId}, + Endpoints: []*sharedtypes.SupplierEndpoint{}, + } + + // Iterate over the service endpoints and add their parsed representation to the supplied service config + for _, endpoint := range svc.Endpoints { + parsedEndpointEntry, err := parseEndpointEntry(endpoint) + if err != nil { + return nil, err + } + service.Endpoints = append(service.Endpoints, parsedEndpointEntry) + } + supplierServiceConfig = append(supplierServiceConfig, service) + } + + return &SupplierStakeConfig{ + StakeAmount: stakeAmount, + Services: supplierServiceConfig, + }, nil +} + +func parseEndpointEntry(endpoint YAMLServiceEndpoint) (*sharedtypes.SupplierEndpoint, error) { + endpointEntry := &sharedtypes.SupplierEndpoint{} + var err error + + // Endpoint URL + if endpointEntry.Url, err = validateEndpointURL(endpoint); err != nil { + return nil, err + } + + // Endpoint config + if endpointEntry.Configs, err = parseEndpointConfigs(endpoint); err != nil { + return nil, err + } + + // Endpoint RPC type + if endpointEntry.RpcType, err = parseEndpointRPCType(endpoint); err != nil { + return nil, err + } + + return endpointEntry, nil +} + +// validateEndpointURL validates the endpoint URL, making sure that the string provided is a valid URL +func validateEndpointURL(endpoint YAMLServiceEndpoint) (string, error) { + // Validate the endpoint URL + if _, err := url.Parse(endpoint.Url); err != nil { + return "", ErrSupplierConfigInvalidURL.Wrapf("%s", err) + } + + return endpoint.Url, nil +} + +// parseEndpointConfigs parses the endpoint config entries into a slice of ConfigOption +// compatible with the SupplierEndpointConfig. +// It accepts a nil config entry or a map of valid config keys. +func parseEndpointConfigs(endpoint YAMLServiceEndpoint) ([]*sharedtypes.ConfigOption, error) { + // Prepare the endpoint configs slice + endpointConfigs := []*sharedtypes.ConfigOption{} + + // If we have an endpoint config entry, parse it into a slice of ConfigOption + if endpoint.Config == nil { + return endpointConfigs, nil + } + + // Iterate over the endpoint config entries and add them to the slice of ConfigOption + for key, value := range endpoint.Config { + var configKey sharedtypes.ConfigOptions + + // Make sure the config key is valid + switch key { + case "timeout": + configKey = sharedtypes.ConfigOptions_TIMEOUT + default: + return nil, ErrSupplierConfigInvalidEndpointConfig.Wrapf("%s", key) + } + + config := &sharedtypes.ConfigOption{ + Key: configKey, + Value: value, + } + endpointConfigs = append(endpointConfigs, config) + } + + return endpointConfigs, nil +} + +// parseEndpointRPCType parses the endpoint RPC type into a sharedtypes.RPCType +func parseEndpointRPCType(endpoint YAMLServiceEndpoint) (sharedtypes.RPCType, error) { + switch endpoint.RPCType { + case "json_rpc": + return sharedtypes.RPCType_JSON_RPC, nil + default: + return sharedtypes.RPCType_UNKNOWN_RPC, ErrSupplierConfigInvalidRPCType.Wrapf("%s", endpoint.RPCType) + } +} diff --git a/x/supplier/config/supplier_configs_reader_test.go b/x/supplier/config/supplier_configs_reader_test.go new file mode 100644 index 000000000..d912156be --- /dev/null +++ b/x/supplier/config/supplier_configs_reader_test.go @@ -0,0 +1 @@ +package config From 82c6a4b07e9d731a34853840c56db032b630a55f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 13:21:34 +0100 Subject: [PATCH 18/23] reconcile: in-memory network --- testutil/network/network.go | 327 +++++++----------------------- x/supplier/module/helpers_test.go | 38 ++++ 2 files changed, 108 insertions(+), 257 deletions(-) create mode 100644 x/supplier/module/helpers_test.go diff --git a/testutil/network/network.go b/testutil/network/network.go index 4bbed2925..308841305 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -4,33 +4,20 @@ import ( "encoding/json" "fmt" "testing" - "time" "cosmossdk.io/math" - sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/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" - appcli "github.com/pokt-network/poktroll/x/application/client/cli" - apptypes "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) type ( @@ -38,9 +25,16 @@ type ( Config = network.Config ) +var addrCodec = addresscodec.NewBech32Codec(app.AccountAddressPrefix) + +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 { + t.Helper() if len(configs) > 1 { panic("at most one config should be provided") } @@ -61,197 +55,26 @@ func New(t *testing.T, configs ...Config) *Network { // DefaultConfig will initialize config for the network with custom application, // genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig func DefaultConfig() network.Config { - var ( - encoding = app.MakeEncodingConfig() - chainID = "chain-" + tmrand.NewRand().Str(6) - ) - return network.Config{ - Codec: encoding.Marshaler, - TxConfig: encoding.TxConfig, - LegacyAmino: encoding.Amino, - InterfaceRegistry: encoding.InterfaceRegistry, - AccountRetriever: authtypes.AccountRetriever{}, - AppConstructor: func(val network.ValidatorI) servertypes.Application { - return app.New( - val.GetCtx().Logger, - tmdb.NewMemDB(), - nil, - true, - map[int64]bool{}, - val.GetCtx().Config.RootDir, - 0, - encoding, - simtestutil.EmptyAppOptions{}, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(chainID), - ) - }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), - TimeoutCommit: 2 * time.Second, - ChainID: chainID, - NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), - PruningStrategy: pruningtypes.PruningOptionNothing, - CleanupDir: true, - SigningAlgo: string(hd.Secp256k1Type), - KeyringOptions: []keyring.Option{}, + cfg, err := network.DefaultConfigWithAppConfig(app.AppConfig()) + if err != nil { + panic(err) } -} - -// TODO_CLEANUP: Refactor the genesis state helpers below to consolidate usage -// and reduce the code footprint. - -// DefaultApplicationModuleGenesisState generates a GenesisState object with a given number of applications. -// It returns the populated GenesisState object. -func DefaultApplicationModuleGenesisState(t *testing.T, n int) *apptypes.GenesisState { - t.Helper() - state := apptypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i+1))) - application := apptypes.Application{ - Address: sample.AccAddress(), - Stake: &stake, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - }, - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d%d", i, i)}, - }, - }, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&application) - state.ApplicationList = append(state.ApplicationList, application) - } - return state -} - -// ApplicationModuleGenesisStateWithAccount generates a GenesisState object with -// a single application for each of the given addresses. -func ApplicationModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *apptypes.GenesisState { - t.Helper() - state := apptypes.DefaultGenesis() - for _, addr := range addresses { - application := apptypes.Application{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - state.ApplicationList = append(state.ApplicationList, application) - } - - return state -} - -// DefaultSupplierModuleGenesisState generates a GenesisState object with a given number of suppliers. -// It returns the populated GenesisState object. -func DefaultSupplierModuleGenesisState(t *testing.T, n int) *suppliertypes.GenesisState { - t.Helper() - state := suppliertypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i))) - supplier := sharedtypes.Supplier{ - Address: sample.AccAddress(), - Stake: &stake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: fmt.Sprintf("http://localhost:%d", i), - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - }, - }, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&supplier) - state.SupplierList = append(state.SupplierList, supplier) + ports, err := freePorts(3) + if err != nil { + panic(err) } - return state -} - -// SupplierModuleGenesisStateWithAddresses generates a GenesisState object with -// a single supplier for each of the given addresses. -func SupplierModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *suppliertypes.GenesisState { - t.Helper() - state := suppliertypes.DefaultGenesis() - for _, addr := range addresses { - supplier := sharedtypes.Supplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:1", - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - }, - }, - } - state.SupplierList = append(state.SupplierList, supplier) + if cfg.APIAddress == "" { + cfg.APIAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[0]) } - - return state -} - -func DefaultTokenomicsModuleGenesisState(t *testing.T) *tokenomicstypes.GenesisState { - t.Helper() - state := tokenomicstypes.DefaultGenesis() - return state -} - -// 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", sdk.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) + if cfg.RPCAddress == "" { + cfg.RPCAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[1]) } - return state -} - -// GatewayModuleGenesisStateWithAddresses generates a GenesisState object with -// a gateway list full of gateways with the given addresses. -// It returns the populated GenesisState object. -func GatewayModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *gatewaytypes.GenesisState { - t.Helper() - state := gatewaytypes.DefaultGenesis() - for _, addr := range addresses { - gateway := gatewaytypes.Gateway{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - } - state.GatewayList = append(state.GatewayList, gateway) + if cfg.GRPCAddress == "" { + cfg.GRPCAddress = fmt.Sprintf("0.0.0.0:%s", ports[2]) } - return state + return cfg } -// 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) { @@ -262,10 +85,10 @@ func InitAccount(t *testing.T, net *Network, addr sdk.AccAddress) { 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()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } - amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) - responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) + amount := sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(200))) + 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) @@ -293,10 +116,10 @@ func InitAccountWithSequence( 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()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } - amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) - responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) + amount := sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(200))) + 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) @@ -304,61 +127,51 @@ func InitAccountWithSequence( require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) } -// DelegateAppToGateway delegates the provided application to the provided gateway -func DelegateAppToGateway( - t *testing.T, - net *Network, - appAddr string, - gatewayAddr string, -) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - gatewayAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), - 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()), +// freePorts return the available ports based on the number of requested ports. +func freePorts(n int) ([]string, error) { + closeFns := make([]func() error, n) + ports := make([]string, n) + for i := 0; i < n; i++ { + _, port, closeFn, err := network.FreeTCPAddr() + if err != nil { + return nil, err + } + ports[i] = port + closeFns[i] = closeFn } - responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdDelegateToGateway(), args) - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) -} - -// UndelegateAppFromGateway undelegates the provided application from the provided gateway -func UndelegateAppFromGateway( - t *testing.T, - net *Network, - appAddr string, - gatewayAddr string, -) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - gatewayAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), - 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()), + for _, closeFn := range closeFns { + if err := closeFn(); err != nil { + return nil, err + } } - responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdUndelegateFromGateway(), args) - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) + return ports, nil } -// TODO_TECHDEBT: Reuse this helper in all test helpers where appropriate. -func NewBondDenomCoins(t *testing.T, net *network.Network, numCoins int64) sdk.Coins { +// DefaultSupplierModuleGenesisState generates a GenesisState object with a given number of suppliers. +// It returns the populated GenesisState object. +func DefaultSupplierModuleGenesisState(t *testing.T, n int) *suppliertypes.GenesisState { t.Helper() - - return sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(numCoins))) + state := suppliertypes.DefaultGenesis() + for i := 0; i < n; i++ { + stake := sdk.NewCoin("upokt", math.NewInt(int64(i))) + supplier := sharedtypes.Supplier{ + Address: sample.AccAddress(), + Stake: &stake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: fmt.Sprintf("http://localhost:%d", i), + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + }, + }, + } + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // nullify.Fill(&supplier) + state.SupplierList = append(state.SupplierList, supplier) + } + return state } diff --git a/x/supplier/module/helpers_test.go b/x/supplier/module/helpers_test.go new file mode 100644 index 000000000..b862169bd --- /dev/null +++ b/x/supplier/module/helpers_test.go @@ -0,0 +1,38 @@ +package supplier_test + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/network" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +const ( + numBlocksPerSession = 4 + testServiceId = "svc1" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +//func init() { +// cmd.InitSDKConfig() +//} + +// networkWithSupplierObjects creates a new network with a given number of supplier objects. +// It returns the network and a slice of the created supplier objects. +func networkWithSupplierObjects(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier) { + t.Helper() + + cfg := network.DefaultConfig() + supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) + buf, err := cfg.Codec.MarshalJSON(supplierGenesisState) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), supplierGenesisState.SupplierList +} From d00fc0fc455ab2718178a0ce93e9c5a9e84f6c2d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 13:22:29 +0100 Subject: [PATCH 19/23] chore: override autocli tx commands --- x/supplier/module/tx.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 x/supplier/module/tx.go diff --git a/x/supplier/module/tx.go b/x/supplier/module/tx.go new file mode 100644 index 000000000..86a9438ae --- /dev/null +++ b/x/supplier/module/tx.go @@ -0,0 +1,37 @@ +package supplier + +import ( + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/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(CmdStakeSupplier()) + cmd.AddCommand(CmdUnstakeSupplier()) + // this line is used by starport scaffolding # 1 + + return cmd +} From 748778439032937200c995b8c10e776f14408924 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 13:22:47 +0100 Subject: [PATCH 20/23] reconcile: stake supplier CLI commands --- x/supplier/module/tx_stake_supplier.go | 67 +++++ x/supplier/module/tx_stake_supplier_test.go | 297 ++++++++++++++++++++ 2 files changed, 364 insertions(+) create mode 100644 x/supplier/module/tx_stake_supplier.go create mode 100644 x/supplier/module/tx_stake_supplier_test.go diff --git a/x/supplier/module/tx_stake_supplier.go b/x/supplier/module/tx_stake_supplier.go new file mode 100644 index 000000000..5923e06ec --- /dev/null +++ b/x/supplier/module/tx_stake_supplier.go @@ -0,0 +1,67 @@ +package supplier + +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/supplier/config" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +var ( + flagStakeConfig string + _ = strconv.Itoa(0) // Part of the default ignite imports +) + +func CmdStakeSupplier() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "stake-supplier --config ", + Short: "Stake a supplier", + Long: `Stake an supplier with the provided parameters. This is a broadcast operation that +will stake the tokens and associate them with the supplier specified by the 'from' address. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --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 + } + + supplierStakeConfigs, err := config.ParseSupplierConfigs(configContent) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgStakeSupplier( + clientCtx.GetFromAddress().String(), + supplierStakeConfigs.StakeAmount, + supplierStakeConfigs.Services, + ) + + 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/supplier/module/tx_stake_supplier_test.go b/x/supplier/module/tx_stake_supplier_test.go new file mode 100644 index 000000000..e7423b0d9 --- /dev/null +++ b/x/supplier/module/tx_stake_supplier_test.go @@ -0,0 +1,297 @@ +package supplier_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" + "github.com/pokt-network/poktroll/testutil/yaml" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestCLI_StakeSupplier(t *testing.T) { + net, _ := networkWithSupplierObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the supplier to be staked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + supplierAccount := 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()), + } + + defaultConfig := ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + ` + + tests := []struct { + desc string + address string + config string + err *sdkerrors.Error + }{ + // Happy Paths + { + desc: "stake supplier: valid", + address: supplierAccount.Address.String(), + config: defaultConfig, + }, + + // Error Paths - Address Related + { + desc: "stake supplier: missing address", + // address: "explicitly missing", + err: types.ErrSupplierInvalidAddress, + config: defaultConfig, + }, + { + desc: "stake supplier: invalid address", + address: "invalid", + err: types.ErrSupplierInvalidAddress, + config: defaultConfig, + }, + + // Error Paths - Stake Related + { + desc: "stake supplier: missing stake", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + # explicitly omitted stake + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + { + desc: "stake supplier: invalid stake denom", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + stake_amount: 1000invalid + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + { + desc: "stake supplier: invalid stake amount (zero)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + stake_amount: 0upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + { + desc: "stake supplier: invalid stake amount (negative)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + stake_amount: -1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + + // Happy Paths - Service Related + { + desc: "services_test: valid multiple services", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + - service_id: svc2 + endpoints: + - url: http://pokt.network:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: valid localhost", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://127.0.0.1:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: valid loopback", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://localhost:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: valid without a pork", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network + rpc_type: json_rpc + `, + }, + + // Error Paths - Service Related + { + desc: "services_test: invalid services (missing argument)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + // servicesString: "explicitly omitted", + config: ` + stake_amount: 1000upokt + `, + }, + { + desc: "services_test: invalid services (empty string)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + `, + }, + { + desc: "services_test: invalid URL", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: bad_url + rpc_type: json_rpc + `, + }, + { + desc: "services_test: missing URLs", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + - service_id: svc2 + `, + }, + { + desc: "services_test: missing service IDs", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - endpoints: + - url: localhost:8081 + rpc_type: json_rpc + - endpoints: + - url: localhost:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: missing rpc type", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: localhost:8082 + `, + }, + } + + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.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.config)).Name() + + // 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, supplier.CmdStakeSupplier(), 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(outStake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} From e956d3ce813d58240cba8875126c693f12cf4e29 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 13:26:42 +0100 Subject: [PATCH 21/23] reconcile: unstake supplier CLI commands --- x/supplier/module/tx_unstake_supplier.go | 42 ++++++++ x/supplier/module/tx_unstake_supplier_test.go | 97 +++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 x/supplier/module/tx_unstake_supplier.go create mode 100644 x/supplier/module/tx_unstake_supplier_test.go diff --git a/x/supplier/module/tx_unstake_supplier.go b/x/supplier/module/tx_unstake_supplier.go new file mode 100644 index 000000000..9c5fa8633 --- /dev/null +++ b/x/supplier/module/tx_unstake_supplier.go @@ -0,0 +1,42 @@ +package supplier + +import ( + "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/supplier/types" +) + +func CmdUnstakeSupplier() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "unstake-supplier", + Short: "Unstake a supplier", + Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUnstakeSupplier( + 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/supplier/module/tx_unstake_supplier_test.go b/x/supplier/module/tx_unstake_supplier_test.go new file mode 100644 index 000000000..75644f58f --- /dev/null +++ b/x/supplier/module/tx_unstake_supplier_test.go @@ -0,0 +1,97 @@ +package supplier_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" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestCLI_UnstakeSupplier(t *testing.T) { + net, _ := networkWithSupplierObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the supplier to be unstaked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + supplierAccount := 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 supplier: valid", + address: supplierAccount.Address.String(), + }, + { + desc: "unstake supplier: missing address", + // address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidAddress, + }, + { + desc: "unstake supplier: invalid address", + address: "invalid", + err: types.ErrSupplierInvalidAddress, + }, + } + + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.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, supplier.CmdUnstakeSupplier(), 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) + }) + } +} From 9faa0105461c570b5c07039822d4ea9a6dd6a6e0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 14 Feb 2024 13:43:43 +0100 Subject: [PATCH 22/23] fix: linter errors --- app/app.go | 1 + x/supplier/module/genesis_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 5c5dbf2fb..d1786b3ff 100644 --- a/app/app.go +++ b/app/app.go @@ -55,6 +55,7 @@ import ( servicemodulekeeper "github.com/pokt-network/poktroll/x/service/keeper" suppliermodulekeeper "github.com/pokt-network/poktroll/x/supplier/keeper" + // this line is used by starport scaffolding # stargate/app/moduleImport "github.com/pokt-network/poktroll/docs" diff --git a/x/supplier/module/genesis_test.go b/x/supplier/module/genesis_test.go index c98821dc4..408ac8710 100644 --- a/x/supplier/module/genesis_test.go +++ b/x/supplier/module/genesis_test.go @@ -11,7 +11,7 @@ import ( "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/module" + supplier "github.com/pokt-network/poktroll/x/supplier/module" "github.com/pokt-network/poktroll/x/supplier/types" ) From 65e2ac81c1f4791a7f4df9277c62409d24479327 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Tue, 20 Feb 2024 10:14:35 +0100 Subject: [PATCH 23/23] chore: supplier module review improvements --- api/poktroll/shared/supplier.pulsar.go | 59 +++++----- api/poktroll/supplier/tx.pulsar.go | 1 + proto/poktroll/shared/supplier.proto | 3 +- proto/poktroll/supplier/genesis.proto | 6 +- proto/poktroll/supplier/params.proto | 6 +- proto/poktroll/supplier/query.proto | 6 +- proto/poktroll/supplier/tx.proto | 26 +++-- testutil/keeper/supplier.go | 8 +- x/supplier/client/cli/query.go | 5 +- x/supplier/client/cli/query_supplier.go | 2 +- x/supplier/client/cli/query_supplier_test.go | 46 ++++---- x/supplier/config/errors.go | 23 ++-- .../config/supplier_configs_reader_test.go | 82 ++++++++++++- x/supplier/keeper/msg_server.go | 4 +- .../keeper/msg_server_stake_supplier.go | 18 ++- .../keeper/msg_server_stake_supplier_test.go | 51 ++++---- x/supplier/keeper/msg_server_test.go | 4 + .../keeper/msg_server_unstake_supplier.go | 5 +- .../msg_server_unstake_supplier_test.go | 22 ++-- x/supplier/keeper/msg_update_params.go | 11 +- x/supplier/keeper/msg_update_params_test.go | 42 ++++--- x/supplier/keeper/params.go | 10 +- x/supplier/keeper/query.go | 4 +- x/supplier/keeper/query_params.go | 7 +- x/supplier/keeper/query_supplier.go | 37 +++--- x/supplier/keeper/query_supplier_test.go | 30 ++--- x/supplier/keeper/supplier.go | 24 ++-- x/supplier/keeper/supplier_test.go | 14 +-- x/supplier/module/autocli.go | 68 +++++------ x/supplier/module/genesis.go | 16 +-- x/supplier/module/helpers_test.go | 1 - x/supplier/module/module.go | 5 +- x/supplier/module/tx.go | 11 +- x/supplier/module/tx_stake_supplier.go | 2 +- x/supplier/module/tx_stake_supplier_test.go | 109 +++++++++--------- x/supplier/module/tx_unstake_supplier_test.go | 39 ++++--- x/supplier/simulation/stake_supplier.go | 2 + x/supplier/simulation/unstake_supplier.go | 1 + x/supplier/types/errors.go | 30 ++--- x/supplier/types/expected_keepers.go | 6 - x/supplier/types/genesis.go | 24 ++-- x/supplier/types/genesis_test.go | 40 +++---- x/supplier/types/key_supplier.go | 10 +- x/supplier/types/keys.go | 8 +- x/supplier/types/message_stake_supplier.go | 2 +- .../types/message_stake_supplier_test.go | 92 +++++++-------- x/supplier/types/message_unstake_supplier.go | 6 +- .../types/message_unstake_supplier_test.go | 28 ++--- ...ate_params.go => message_update_params.go} | 2 +- x/supplier/types/params.go | 4 +- x/supplier/types/types.go | 2 + 51 files changed, 561 insertions(+), 503 deletions(-) rename x/supplier/types/{msg_update_params.go => message_update_params.go} (91%) diff --git a/api/poktroll/shared/supplier.pulsar.go b/api/poktroll/shared/supplier.pulsar.go index a0e0c637e..ac65f36e6 100644 --- a/api/poktroll/shared/supplier.pulsar.go +++ b/api/poktroll/shared/supplier.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" @@ -723,36 +722,34 @@ var file_poktroll_shared_supplier_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, - 0x6f, 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, 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, 0x73, 0x68, 0x61, - 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, - 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 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, 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, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x08, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0x12, 0x42, 0x0a, + 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, + 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index 362a13a3b..d35e3f491 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -2663,6 +2663,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/supplier parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } diff --git a/proto/poktroll/shared/supplier.proto b/proto/poktroll/shared/supplier.proto index 42c65eb67..5553f5673 100644 --- a/proto/poktroll/shared/supplier.proto +++ b/proto/poktroll/shared/supplier.proto @@ -2,9 +2,10 @@ syntax = "proto3"; package poktroll.shared; option go_package = "github.com/pokt-network/poktroll/x/shared/types"; -import "gogoproto/gogo.proto"; + import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/shared/service.proto"; // Supplier is the type defining the actor in Pocket Network that provides RPC services. diff --git a/proto/poktroll/supplier/genesis.proto b/proto/poktroll/supplier/genesis.proto index 5970cc005..dbda0e28a 100644 --- a/proto/poktroll/supplier/genesis.proto +++ b/proto/poktroll/supplier/genesis.proto @@ -1,14 +1,14 @@ syntax = "proto3"; - package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/supplier/params.proto"; import "poktroll/shared/supplier.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - // GenesisState defines the supplier module's genesis state. message GenesisState { diff --git a/proto/poktroll/supplier/params.proto b/proto/poktroll/supplier/params.proto index 031afe85a..a27a7ba7c 100644 --- a/proto/poktroll/supplier/params.proto +++ b/proto/poktroll/supplier/params.proto @@ -1,15 +1,13 @@ syntax = "proto3"; package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/supplier/Params"; option (gogoproto.equal) = true; - - } \ No newline at end of file diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto index 8d3ad532d..4220f9a39 100644 --- a/proto/poktroll/supplier/query.proto +++ b/proto/poktroll/supplier/query.proto @@ -1,18 +1,18 @@ syntax = "proto3"; - package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/supplier/params.proto"; import "poktroll/shared/supplier.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - // Query defines the gRPC querier service. service Query { diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 79ed6f5c3..ef75baa2f 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -1,21 +1,22 @@ syntax = "proto3"; - package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/supplier/params.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/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 ); @@ -24,14 +25,17 @@ service Msg { } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // 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/supplier parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -42,8 +46,8 @@ message MsgUpdateParamsResponse {} message MsgStakeSupplier { option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) repeated poktroll.shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for } @@ -51,7 +55,7 @@ message MsgStakeSupplierResponse {} message MsgUnstakeSupplier { option (cosmos.msg.v1.signer) = "address"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding } message MsgUnstakeSupplierResponse {} diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go index ba9cb9b46..85c1cdff1 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" @@ -23,7 +24,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func SupplierKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func SupplierKeeper(t testing.TB) (keeper.Keeper, context.Context) { t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) @@ -53,7 +54,10 @@ func SupplierKeeper(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 } + +// TODO_OPTIMIZE: Index suppliers by service so we can easily query k.GetAllSuppliers(ctx, Service) +// func (k Keeper) GetAllSuppliers(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/client/cli/query.go b/x/supplier/client/cli/query.go index e87eda8ed..991af20c2 100644 --- a/x/supplier/client/cli/query.go +++ b/x/supplier/client/cli/query.go @@ -10,7 +10,8 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. +func (am AppModule) GetQueryCmd() *cobra.Command { // Group supplier queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, @@ -21,7 +22,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListSupplier()) + cmd.AddCommand(CmdListSuppliers()) cmd.AddCommand(CmdShowSupplier()) cmd.AddCommand(CmdListClaims()) cmd.AddCommand(CmdShowClaim()) diff --git a/x/supplier/client/cli/query_supplier.go b/x/supplier/client/cli/query_supplier.go index 604c1182f..828762265 100644 --- a/x/supplier/client/cli/query_supplier.go +++ b/x/supplier/client/cli/query_supplier.go @@ -8,7 +8,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func CmdListSupplier() *cobra.Command { +func CmdListSuppliers() *cobra.Command { cmd := &cobra.Command{ Use: "list-supplier", Short: "list all supplier", diff --git a/x/supplier/client/cli/query_supplier_test.go b/x/supplier/client/cli/query_supplier_test.go index bf05a5d44..e629f4287 100644 --- a/x/supplier/client/cli/query_supplier_test.go +++ b/x/supplier/client/cli/query_supplier_test.go @@ -10,11 +10,15 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/pokt-network/poktroll/testutil/nullify" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/cli" "github.com/pokt-network/poktroll/x/supplier/types" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/nullify" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/types" ) func TestShowSupplier(t *testing.T) { @@ -28,43 +32,43 @@ func TestShowSupplier(t *testing.T) { desc string idAddress string - args []string - err error - obj sharedtypes.Supplier + args []string + expectedErr error + supplier sharedtypes.Supplier }{ { desc: "supplier found", idAddress: suppliers[0].Address, - args: common, - obj: suppliers[0], + args: common, + supplier: suppliers[0], }, { desc: "supplier 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...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowSupplier(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) + args = append(args, test.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdShowSupplier(), args) + 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.QueryGetSupplierResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NotNil(t, resp.Supplier) require.Equal(t, - nullify.Fill(&tc.obj), + nullify.Fill(&test.supplier), nullify.Fill(&resp.Supplier), ) } @@ -72,7 +76,7 @@ func TestShowSupplier(t *testing.T) { } } -func TestListSupplier(t *testing.T) { +func TestListSuppliers(t *testing.T) { net, suppliers := networkWithSupplierObjects(t, 5) ctx := net.Validators[0].ClientCtx @@ -95,7 +99,7 @@ func TestListSupplier(t *testing.T) { step := 2 for i := 0; i < len(suppliers); i += step { args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSuppliers(), args) require.NoError(t, err) var resp types.QueryAllSupplierResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) @@ -111,7 +115,7 @@ func TestListSupplier(t *testing.T) { var next []byte for i := 0; i < len(suppliers); i += step { args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSuppliers(), args) require.NoError(t, err) var resp types.QueryAllSupplierResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) @@ -125,7 +129,7 @@ func TestListSupplier(t *testing.T) { }) t.Run("Total", func(t *testing.T) { args := request(nil, 0, uint64(len(suppliers)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSuppliers(), args) require.NoError(t, err) var resp types.QueryAllSupplierResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) diff --git a/x/supplier/config/errors.go b/x/supplier/config/errors.go index 6a0194a75..80be44969 100644 --- a/x/supplier/config/errors.go +++ b/x/supplier/config/errors.go @@ -1,15 +1,18 @@ package config -import sdkerrors "cosmossdk.io/errors" +import ( + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/x/supplier/types" +) var ( - codespace = "supplierconfig" - ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrSupplierConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in supplier config") - ErrSupplierConfigNoEndpoints = sdkerrors.Register(codespace, 3, "no endpoints defined for serviceId in supplier config") - ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(codespace, 4, "invalid endpoint config in supplier config") - ErrSupplierConfigInvalidRPCType = sdkerrors.Register(codespace, 5, "invalid rpc type in supplier config") - ErrSupplierConfigInvalidURL = sdkerrors.Register(codespace, 6, "invalid endpoint url in supplier config") - ErrSupplierConfigEmptyContent = sdkerrors.Register(codespace, 7, "empty supplier config content") - ErrSupplierConfigInvalidStake = sdkerrors.Register(codespace, 8, "invalid stake amount in supplier config") + ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(types.ModuleName, 2100, "config reader cannot unmarshal yaml content") + ErrSupplierConfigInvalidServiceId = sdkerrors.Register(types.ModuleName, 2101, "invalid serviceId in supplier config") + ErrSupplierConfigNoEndpoints = sdkerrors.Register(types.ModuleName, 2102, "no endpoints defined for serviceId in supplier config") + ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(types.ModuleName, 2103, "invalid endpoint config in supplier config") + ErrSupplierConfigInvalidRPCType = sdkerrors.Register(types.ModuleName, 2104, "invalid rpc type in supplier config") + ErrSupplierConfigInvalidURL = sdkerrors.Register(types.ModuleName, 2105, "invalid endpoint url in supplier config") + ErrSupplierConfigEmptyContent = sdkerrors.Register(types.ModuleName, 2106, "empty supplier config content") + ErrSupplierConfigInvalidStake = sdkerrors.Register(types.ModuleName, 2107, "invalid stake amount in supplier config") ) diff --git a/x/supplier/config/supplier_configs_reader_test.go b/x/supplier/config/supplier_configs_reader_test.go index d912156be..28d567fbb 100644 --- a/x/supplier/config/supplier_configs_reader_test.go +++ b/x/supplier/config/supplier_configs_reader_test.go @@ -1 +1,81 @@ -package config +package config_test + +import ( + "testing" + + sdkerrors "cosmossdk.io/errors" + "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 + expectedErr *sdkerrors.Error + expectedConfig *config.GatewayStakeConfig + inputConfig string + }{ + // Valid Configs + { + desc: "valid gateway stake config", + inputConfig: ` + stake_amount: 1000upokt + `, + expectedErr: nil, + expectedConfig: &config.GatewayStakeConfig{ + StakeAmount: sdk.NewCoin("upokt", math.NewInt(1000)), + }, + }, + // Invalid Configs + { + desc: "services_test: invalid service config with empty content", + expectedErr: config.ErrGatewayConfigEmptyContent, + inputConfig: ``, + }, + { + desc: "invalid stake denom", + inputConfig: ` + stake_amount: 1000invalid + `, + expectedErr: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "negative stake amount", + inputConfig: ` + stake_amount: -1000upokt + `, + expectedErr: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "zero stake amount", + inputConfig: ` + stake_amount: 0upokt + `, + expectedErr: 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.expectedErr != nil { + require.Error(t, err) + require.ErrorIs(t, err, tt.expectedErr) + require.Contains(t, err.Error(), tt.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) + }) + } +} diff --git a/x/supplier/keeper/msg_server.go b/x/supplier/keeper/msg_server.go index 83879071c..fc7ad310a 100644 --- a/x/supplier/keeper/msg_server.go +++ b/x/supplier/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) +import "github.com/pokt-network/poktroll/x/supplier/types" type msgServer struct { Keeper diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index d99447da1..3d6101f97 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -4,16 +4,13 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - +func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { logger := k.Logger().With("method", "StakeSupplier") logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) @@ -26,6 +23,7 @@ func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSuppl var err error var coinsToDelegate sdk.Coin supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) + if !isSupplierFound { logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) supplier = k.createSupplier(ctx, msg) @@ -62,7 +60,7 @@ func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSuppl } func (k msgServer) createSupplier( - ctx sdk.Context, + _ context.Context, msg *types.MsgStakeSupplier, ) sharedtypes.Supplier { return sharedtypes.Supplier{ @@ -73,29 +71,29 @@ func (k msgServer) createSupplier( } func (k msgServer) updateSupplier( - ctx sdk.Context, + _ context.Context, supplier *sharedtypes.Supplier, msg *types.MsgStakeSupplier, ) error { // Checks if the the msg address is the same as the current owner if msg.Address != supplier.Address { - return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) + return types.ErrSupplierUnauthorized.Wrapf("msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) } // Validate that the stake is not being lowered if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") + return types.ErrSupplierInvalidStake.Wrapf("stake amount cannot be nil") } if msg.Stake.IsLTE(*supplier.Stake) { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) + return types.ErrSupplierInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) } supplier.Stake = msg.Stake // Validate that the service configs maintain at least one service. // Additional validation is done in `msg.ValidateBasic` above. if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") + return types.ErrSupplierInvalidServiceConfig.Wrapf("must have at least one service") } supplier.Services = msg.Services diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index c97ee5558..b0d3f1d50 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -17,18 +17,17 @@ import ( func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { k, ctx := keepertest.SupplierKeeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) // Generate an address for the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) // Prepare the stakeMsg stakeMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -47,22 +46,22 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { } // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) + _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Verify that the supplier exists - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) + foundSupplier, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) - require.Equal(t, addr, supplierFound.Address) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) + require.Equal(t, supplierAddr, foundSupplier.Address) + require.Equal(t, int64(100), foundSupplier.Stake.Amount.Int64()) + require.Len(t, foundSupplier.Services, 1) + require.Equal(t, "svcId", foundSupplier.Services[0].Service.Id) + require.Len(t, foundSupplier.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8080", foundSupplier.Services[0].Endpoints[0].Url) // Prepare an updated supplier with a higher stake and a different URL for the service updateMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -81,15 +80,16 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { } // Update the staked supplier - _, err = srv.StakeSupplier(wctx, updateMsg) + _, err = srv.StakeSupplier(ctx, updateMsg) require.NoError(t, err) - supplierFound, isSupplierFound = k.GetSupplier(ctx, addr) + + foundSupplier, isSupplierFound = k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) - require.Equal(t, int64(200), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId2", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8082", supplierFound.Services[0].Endpoints[0].Url) + require.Equal(t, int64(200), foundSupplier.Stake.Amount.Int64()) + require.Len(t, foundSupplier.Services, 1) + require.Equal(t, "svcId2", foundSupplier.Services[0].Service.Id) + require.Len(t, foundSupplier.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8082", foundSupplier.Services[0].Endpoints[0].Url) } func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) { @@ -177,9 +177,9 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Prepare the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() stakeMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -200,12 +200,13 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { // Stake the supplier & verify that the supplier exists _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) - _, isSupplierFound := k.GetSupplier(ctx, addr) + + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) // Prepare an updated supplier with a lower stake updateMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -228,7 +229,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { require.Error(t, err) // Verify that the supplier stake is unchanged - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) + supplierFound, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) require.Len(t, supplierFound.Services, 1) diff --git a/x/supplier/keeper/msg_server_test.go b/x/supplier/keeper/msg_server_test.go index 480dd0262..e9ef42753 100644 --- a/x/supplier/keeper/msg_server_test.go +++ b/x/supplier/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.SupplierKeeper(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/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go index 41f3de736..cb9c6230c 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ b/x/supplier/keeper/msg_server_unstake_supplier.go @@ -9,12 +9,11 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) +// TODO(#73): Determine if an application needs an unbonding period after unstaking. func (k msgServer) UnstakeSupplier( - goCtx context.Context, + ctx context.Context, msg *types.MsgUnstakeSupplier, ) (*types.MsgUnstakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger().With("method", "UnstakeSupplier") logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go index c3b9d9144..fc601f9d9 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ b/x/supplier/keeper/msg_server_unstake_supplier_test.go @@ -19,16 +19,16 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) // Prepare the supplier initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &initialStake, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -51,19 +51,19 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { require.NoError(t, err) // Verify that the supplier exists - foundSupplier, isSupplierFound := k.GetSupplier(ctx, addr) + foundSupplier, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) - require.Equal(t, addr, foundSupplier.Address) + require.Equal(t, supplierAddr, foundSupplier.Address) require.Equal(t, initialStake.Amount, foundSupplier.Stake.Amount) require.Len(t, foundSupplier.Services, 1) // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} + unstakeMsg := &types.MsgUnstakeSupplier{Address: supplierAddr} _, err = srv.UnstakeSupplier(ctx, unstakeMsg) require.NoError(t, err) // Make sure the supplier can no longer be found after unstaking - _, isSupplierFound = k.GetSupplier(ctx, addr) + _, isSupplierFound = k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) } @@ -72,18 +72,18 @@ func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} + unstakeMsg := &types.MsgUnstakeSupplier{Address: supplierAddr} _, err := srv.UnstakeSupplier(ctx, unstakeMsg) require.Error(t, err) require.ErrorIs(t, err, types.ErrSupplierNotFound) - _, isSupplierFound = k.GetSupplier(ctx, addr) + _, isSupplierFound = k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) } diff --git a/x/supplier/keeper/msg_update_params.go b/x/supplier/keeper/msg_update_params.go index 01aaace7c..dbec01545 100644 --- a/x/supplier/keeper/msg_update_params.go +++ b/x/supplier/keeper/msg_update_params.go @@ -3,18 +3,17 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams( + ctx 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) + return nil, types.ErrSupplierInvalidSigner.Wrapf("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 } diff --git a/x/supplier/keeper/msg_update_params_test.go b/x/supplier/keeper/msg_update_params_test.go index 2e179b220..ccbb6ef2e 100644 --- a/x/supplier/keeper/msg_update_params_test.go +++ b/x/supplier/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/supplier/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 + params *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", - input: &types.MsgUpdateParams{ + desc: "invalid authority", + params: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", - input: &types.MsgUpdateParams{ + desc: "send enabled param", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", - input: &types.MsgUpdateParams{ + desc: "all good", + params: &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.params) - 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/supplier/keeper/params.go b/x/supplier/keeper/params.go index 6e3162e05..4e7dab63d 100644 --- a/x/supplier/keeper/params.go +++ b/x/supplier/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/supplier/keeper/query.go b/x/supplier/keeper/query.go index 2d1d5c18e..ff0dc934d 100644 --- a/x/supplier/keeper/query.go +++ b/x/supplier/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) +import "github.com/pokt-network/poktroll/x/supplier/types" var _ types.QueryServer = Keeper{} diff --git a/x/supplier/keeper/query_params.go b/x/supplier/keeper/query_params.go index 67e2a17f4..234f4c50b 100644 --- a/x/supplier/keeper/query_params.go +++ b/x/supplier/keeper/query_params.go @@ -3,18 +3,19 @@ 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/supplier/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/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go index d364ede93..f1f5f21c8 100644 --- a/x/supplier/keeper/query_supplier.go +++ b/x/supplier/keeper/query_supplier.go @@ -14,7 +14,10 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRequest) (*types.QueryAllSuppliersResponse, error) { +func (k Keeper) AllSuppliers( + ctx context.Context, + req *types.QueryAllSuppliersRequest, +) (*types.QueryAllSuppliersResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -24,15 +27,19 @@ func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRe store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) - pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { - var supplier sharedtypes.Supplier - if err := k.cdc.Unmarshal(value, &supplier); err != nil { - return err - } + pageRes, err := query.Paginate( + supplierStore, + req.Pagination, + func(key []byte, value []byte) error { + var supplier sharedtypes.Supplier + if err := k.cdc.Unmarshal(value, &supplier); err != nil { + return err + } - suppliers = append(suppliers, supplier) - return nil - }) + suppliers = append(suppliers, supplier) + return nil + }, + ) if err != nil { return nil, status.Error(codes.Internal, err.Error()) @@ -41,17 +48,17 @@ func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRe return &types.QueryAllSuppliersResponse{Supplier: suppliers, Pagination: pageRes}, nil } -func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { +func (k Keeper) Supplier( + ctx context.Context, + req *types.QueryGetSupplierRequest, +) (*types.QueryGetSupplierResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - supplier, found := k.GetSupplier( - ctx, - req.Address, - ) + supplier, found := k.GetSupplier(ctx, req.Address) if !found { - // TODO_TECHDEBT(#181): conform to logging conventions once established + // TODO_TECHDEBT(#384): conform to logging conventions once established msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) return nil, status.Error(codes.NotFound, msg) } diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go index ca80180c3..268390cf5 100644 --- a/x/supplier/keeper/query_supplier_test.go +++ b/x/supplier/keeper/query_supplier_test.go @@ -19,12 +19,12 @@ var _ = strconv.IntSize func TestSupplierQuerySingle(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 2) + suppliers := createNSuppliers(keeper, ctx, 2) tests := []struct { - desc string - request *types.QueryGetSupplierRequest - response *types.QueryGetSupplierResponse - err error + desc string + request *types.QueryGetSupplierRequest + response *types.QueryGetSupplierResponse + expectedErr error }{ { desc: "First", @@ -45,22 +45,22 @@ func TestSupplierQuerySingle(t *testing.T) { request: &types.QueryGetSupplierRequest{ Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "supplier with address \"100000\""), + expectedErr: status.Error(codes.NotFound, "supplier with address \"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.Supplier(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.Supplier(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), ) } @@ -70,7 +70,7 @@ func TestSupplierQuerySingle(t *testing.T) { func TestSupplierQueryPaginated(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - msgs := createNSupplier(keeper, ctx, 5) + msgs := createNSuppliers(keeper, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSuppliersRequest { return &types.QueryAllSuppliersRequest{ diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go index 9f2ba9eb3..af9f8778b 100644 --- a/x/supplier/keeper/supplier.go +++ b/x/supplier/keeper/supplier.go @@ -24,15 +24,12 @@ func (k Keeper) SetSupplier(ctx context.Context, supplier sharedtypes.Supplier) // GetSupplier returns a supplier from its index func (k Keeper) GetSupplier( ctx context.Context, - address string, - + supplierAddr string, ) (supplier sharedtypes.Supplier, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) - supplierBz := store.Get(types.SupplierKey( - address, - )) + supplierBz := store.Get(types.SupplierKey(supplierAddr)) if supplierBz == nil { return supplier, false } @@ -42,20 +39,14 @@ func (k Keeper) GetSupplier( } // RemoveSupplier removes a supplier from the store -func (k Keeper) RemoveSupplier( - ctx context.Context, - address string, - -) { +func (k Keeper) RemoveSupplier(ctx context.Context, address string) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) - store.Delete(types.SupplierKey( - address, - )) + store.Delete(types.SupplierKey(address)) } -// GetAllSupplier returns all supplier -func (k Keeper) GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Supplier) { +// GetAllSuppliers returns all supplier +func (k Keeper) GetAllSuppliers(ctx context.Context) (suppliers []sharedtypes.Supplier) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) @@ -70,3 +61,6 @@ func (k Keeper) GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Sup return } + +// TODO_OPTIMIZE: Index suppliers by service so we can easily query k.GetAllSuppliers(ctx, Service) +// func (k Keeper) GetAllSuppliers(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go index 28e324e07..c30d8a083 100644 --- a/x/supplier/keeper/supplier_test.go +++ b/x/supplier/keeper/supplier_test.go @@ -27,7 +27,7 @@ func init() { cmd.InitSDKConfig() } -func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Supplier { +func createNSuppliers(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Supplier { suppliers := make([]sharedtypes.Supplier, n) for i := range suppliers { supplier := &suppliers[i] @@ -53,7 +53,7 @@ func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []sharedt func TestSupplierGet(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 10) + suppliers := createNSuppliers(keeper, ctx, 10) for _, supplier := range suppliers { supplierFound, isSupplierFound := keeper.GetSupplier(ctx, supplier.Address, @@ -68,11 +68,9 @@ func TestSupplierGet(t *testing.T) { func TestSupplierRemove(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 10) + suppliers := createNSuppliers(keeper, ctx, 10) for _, supplier := range suppliers { - keeper.RemoveSupplier(ctx, - supplier.Address, - ) + keeper.RemoveSupplier(ctx, supplier.Address) _, isSupplierFound := keeper.GetSupplier(ctx, supplier.Address, ) @@ -82,10 +80,10 @@ func TestSupplierRemove(t *testing.T) { func TestSupplierGetAll(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 10) + suppliers := createNSuppliers(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(suppliers), - nullify.Fill(keeper.GetAllSupplier(ctx)), + nullify.Fill(keeper.GetAllSuppliers(ctx)), ) } diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index ec75e7031..6a3afe3a9 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/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: "AllSuppliers", - Use: "list-supplier", - Short: "List all supplier", - }, - { - RpcMethod: "Supplier", - Use: "show-supplier [id]", - Short: "Shows a supplier", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, - }, + //{ + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + //}, + //{ + // RpcMethod: "AllSuppliers", + // Use: "list-supplier", + // Short: "List all supplier", + //}, + //{ + // RpcMethod: "Supplier", + // Use: "show-supplier [id]", + // Short: "Shows a supplier", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + //}, // 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: "StakeSupplier", - Use: "stake-supplier [stake] [services]", - Short: "Send a stake-supplier tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, - }, - { - RpcMethod: "UnstakeSupplier", - Use: "unstake-supplier", - Short: "Send a unstake-supplier tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + //{ + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + //}, + //{ + // RpcMethod: "StakeSupplier", + // Use: "stake-supplier [stake] [services]", + // Short: "Send a stake-supplier tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, + //}, + //{ + // RpcMethod: "UnstakeSupplier", + // Use: "unstake-supplier", + // Short: "Send a unstake-supplier tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + //}, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/supplier/module/genesis.go b/x/supplier/module/genesis.go index f0a857fe4..d6d7d1b34 100644 --- a/x/supplier/module/genesis.go +++ b/x/supplier/module/genesis.go @@ -1,28 +1,30 @@ package supplier import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/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 supplier - for _, elem := range genState.SupplierList { - k.SetSupplier(ctx, elem) + for _, supplier := range genState.SupplierList { + k.SetSupplier(ctx, supplier) } // 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.SupplierList = k.GetAllSupplier(ctx) + genesis.SupplierList = k.GetAllSuppliers(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/supplier/module/helpers_test.go b/x/supplier/module/helpers_test.go index b862169bd..ffc741f7c 100644 --- a/x/supplier/module/helpers_test.go +++ b/x/supplier/module/helpers_test.go @@ -28,7 +28,6 @@ var _ = strconv.IntSize // It returns the network and a slice of the created supplier objects. func networkWithSupplierObjects(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier) { t.Helper() - cfg := network.DefaultConfig() supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) buf, err := cfg.Codec.MarshalJSON(supplierGenesisState) diff --git a/x/supplier/module/module.go b/x/supplier/module/module.go index 6cb134ae6..8ac44e592 100644 --- a/x/supplier/module/module.go +++ b/x/supplier/module/module.go @@ -166,10 +166,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/supplier/module/tx.go b/x/supplier/module/tx.go index 86a9438ae..535cfa1f7 100644 --- a/x/supplier/module/tx.go +++ b/x/supplier/module/tx.go @@ -2,7 +2,6 @@ package supplier import ( "fmt" - "time" "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" @@ -10,16 +9,8 @@ import ( "github.com/pokt-network/poktroll/x/supplier/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/supplier/module/tx_stake_supplier.go b/x/supplier/module/tx_stake_supplier.go index 5923e06ec..a9dd920cf 100644 --- a/x/supplier/module/tx_stake_supplier.go +++ b/x/supplier/module/tx_stake_supplier.go @@ -27,7 +27,7 @@ func CmdStakeSupplier() *cobra.Command { will stake the tokens and associate them with the supplier specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, +$ poktrolld tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { diff --git a/x/supplier/module/tx_stake_supplier_test.go b/x/supplier/module/tx_stake_supplier_test.go index e7423b0d9..44b0c5122 100644 --- a/x/supplier/module/tx_stake_supplier_test.go +++ b/x/supplier/module/tx_stake_supplier_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" @@ -29,6 +29,9 @@ func TestCLI_StakeSupplier(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) supplierAccount := accounts[0] + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -36,7 +39,7 @@ func TestCLI_StakeSupplier(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()), } defaultConfig := ` @@ -49,10 +52,10 @@ func TestCLI_StakeSupplier(t *testing.T) { ` tests := []struct { - desc string - address string - config string - err *sdkerrors.Error + desc string + address string + config string + expectedErr *sdkerrors.Error }{ // Happy Paths { @@ -65,21 +68,21 @@ func TestCLI_StakeSupplier(t *testing.T) { { desc: "stake supplier: missing address", // address: "explicitly missing", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, + expectedErr: types.ErrSupplierInvalidAddress, + config: defaultConfig, }, { - desc: "stake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, + desc: "stake supplier: invalid address", + address: "invalid", + expectedErr: types.ErrSupplierInvalidAddress, + config: defaultConfig, }, // Error Paths - Stake Related { - desc: "stake supplier: missing stake", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: missing stake", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` # explicitly omitted stake services: @@ -90,9 +93,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "stake supplier: invalid stake denom", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: invalid stake denom", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` stake_amount: 1000invalid services: @@ -103,9 +106,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "stake supplier: invalid stake amount (zero)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: invalid stake amount (zero)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` stake_amount: 0upokt services: @@ -116,9 +119,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "stake supplier: invalid stake amount (negative)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: invalid stake amount (negative)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` stake_amount: -1000upokt services: @@ -185,27 +188,27 @@ func TestCLI_StakeSupplier(t *testing.T) { // Error Paths - Service Related { - desc: "services_test: invalid services (missing argument)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - // servicesString: "explicitly omitted", + desc: "services_test: invalid services (missing argument)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, + // servicesString explicitly omitted config: ` stake_amount: 1000upokt `, }, { - desc: "services_test: invalid services (empty string)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: invalid services (empty string)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: `, }, { - desc: "services_test: invalid URL", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: invalid URL", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -216,9 +219,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "services_test: missing URLs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: missing URLs", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -227,9 +230,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "services_test: missing service IDs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: missing service IDs", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -242,9 +245,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "services_test: missing rpc type", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: missing rpc type", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -255,22 +258,19 @@ func TestCLI_StakeSupplier(t *testing.T) { }, } - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.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.config)).Name() + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(test.config)).Name() // 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...) @@ -278,15 +278,16 @@ func TestCLI_StakeSupplier(t *testing.T) { outStake, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdStakeSupplier(), 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) - // Check the response + // Check the response, this test only asserts CLI command success and not + // the actual supplier module state. var resp sdk.TxResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) require.NotNil(t, resp) diff --git a/x/supplier/module/tx_unstake_supplier_test.go b/x/supplier/module/tx_unstake_supplier_test.go index 75644f58f..2d13d8797 100644 --- a/x/supplier/module/tx_unstake_supplier_test.go +++ b/x/supplier/module/tx_unstake_supplier_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_UnstakeSupplier(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) supplierAccount := accounts[0] + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -35,13 +38,13 @@ func TestCLI_UnstakeSupplier(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 supplier: valid", @@ -50,27 +53,24 @@ func TestCLI_UnstakeSupplier(t *testing.T) { { desc: "unstake supplier: missing address", // address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidAddress, + expectedErr: types.ErrSupplierInvalidAddress, }, { - desc: "unstake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, + desc: "unstake supplier: invalid address", + address: "invalid", + expectedErr: types.ErrSupplierInvalidAddress, }, } - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.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,15 +78,16 @@ func TestCLI_UnstakeSupplier(t *testing.T) { outUnstake, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdUnstakeSupplier(), 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) - // Check the response + // Check the response, this test only asserts CLI command success and not + // the actual supplier module state. var resp sdk.TxResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) require.NotNil(t, resp) diff --git a/x/supplier/simulation/stake_supplier.go b/x/supplier/simulation/stake_supplier.go index a6f79739c..29acc1fd4 100644 --- a/x/supplier/simulation/stake_supplier.go +++ b/x/supplier/simulation/stake_supplier.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/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -20,6 +21,7 @@ func SimulateMsgStakeSupplier( simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgStakeSupplier{ Address: simAccount.Address.String(), + // TODO: Update all stake message fields } // TODO: Handling the StakeSupplier simulation diff --git a/x/supplier/simulation/unstake_supplier.go b/x/supplier/simulation/unstake_supplier.go index 377b74176..06a2a38c3 100644 --- a/x/supplier/simulation/unstake_supplier.go +++ b/x/supplier/simulation/unstake_supplier.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/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go index b6424cc9f..c89c13e39 100644 --- a/x/supplier/types/errors.go +++ b/x/supplier/types/errors.go @@ -2,26 +2,18 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/supplier module sentinel errors var ( - ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") - ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") - ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") - ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") - ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") - ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") - ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") - ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") - ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") - ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") - ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") - ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") - ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") - ErrSupplierInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") - ErrSupplierInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSupplierInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1101, "invalid supplier stake") + ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid address") + ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized supplier signer") + ErrSupplierNotFound = sdkerrors.Register(ModuleName, 1104, "supplier not found") + ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 1105, "invalid service config") + ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 1106, "invalid session start height") + ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 1107, "invalid session ID") + ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 1108, "invalid service in supplier") + ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 1109, "invalid session ending height") ) diff --git a/x/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go index 6680b26e0..c0d57d5d4 100644 --- a/x/supplier/types/expected_keepers.go +++ b/x/supplier/types/expected_keepers.go @@ -19,9 +19,3 @@ type BankKeeper interface { 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. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go index 9d06b42ff..d7d3a341a 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/types/genesis.go @@ -3,16 +3,12 @@ package types import ( "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ @@ -26,13 +22,13 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in supplier - supplierIndexMap := make(map[string]struct{}) + supplierAddrMap := make(map[string]struct{}) for _, supplier := range gs.SupplierList { - index := string(SupplierKey(supplier.Address)) - if _, ok := supplierIndexMap[index]; ok { + supplierAddr := string(SupplierKey(supplier.Address)) + if _, ok := supplierAddrMap[supplierAddr]; ok { return fmt.Errorf("duplicated index for supplier") } - supplierIndexMap[index] = struct{}{} + supplierAddrMap[supplierAddr] = struct{}{} } // Check that the stake value for the suppliers is valid @@ -40,25 +36,25 @@ func (gs GenesisState) Validate() error { // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, // similar to how we have `ValidateAppServiceConfigs` below if supplier.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") + return ErrSupplierInvalidStake.Wrapf("nil stake amount for supplier") } stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) + return ErrSupplierInvalidStake.Wrapf("invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) + return ErrSupplierInvalidStake.Wrapf("cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) + return ErrSupplierInvalidStake.Wrapf("invalid stake amount for supplier: %v <= 0", supplier.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) + return ErrSupplierInvalidStake.Wrapf("invalid stake amount denom for supplier %v", supplier.Stake) } // Validate the application service configs if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) + return ErrSupplierInvalidServiceConfig.Wrapf(err.Error()) } } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index 282c2b01d..23b16b327 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -48,12 +48,12 @@ func TestGenesisState_Validate(t *testing.T) { tests := []struct { desc string genState *types.GenesisState - valid bool + isValid bool }{ { desc: "default is valid", genState: types.DefaultGenesis(), - valid: true, + isValid: true, }, { desc: "valid genesis state", @@ -73,7 +73,7 @@ func TestGenesisState_Validate(t *testing.T) { }, // this line is used by starport scaffolding # types/genesis/validField }, - valid: true, + isValid: true, }, { desc: "invalid - zero supplier stake", @@ -91,7 +91,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - negative supplier stake", @@ -109,7 +109,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - wrong stake denom", @@ -127,7 +127,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - missing denom", @@ -145,7 +145,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - due to duplicated supplier address", @@ -163,7 +163,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - due to nil supplier stake", @@ -181,7 +181,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - due to missing supplier stake", @@ -194,12 +194,12 @@ func TestGenesisState_Validate(t *testing.T) { }, { Address: addr2, - // Explicitly missing stake + // Stake explicitly omitted Services: serviceList2, }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - missing services list", @@ -213,11 +213,11 @@ func TestGenesisState_Validate(t *testing.T) { { Address: addr2, Stake: &stake2, - // Services: intentionally omitted + // Services explicitly omitted }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - empty services list", @@ -235,7 +235,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - invalid URL", @@ -266,7 +266,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - invalid RPC Type", @@ -297,14 +297,14 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: 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 { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.isValid { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/supplier/types/key_supplier.go b/x/supplier/types/key_supplier.go index e91fd76e4..b23c0ec8b 100644 --- a/x/supplier/types/key_supplier.go +++ b/x/supplier/types/key_supplier.go @@ -6,17 +6,15 @@ var _ binary.ByteOrder const ( // SupplierKeyPrefix is the prefix to retrieve all Supplier - SupplierKeyPrefix = "Supplier/value/" + SupplierKeyPrefix = "Supplier/address/" ) // SupplierKey returns the store key to retrieve a Supplier from the index fields -func SupplierKey( - index string, -) []byte { +func SupplierKey(supplierAddr string) []byte { var key []byte - indexBytes := []byte(index) - key = append(key, indexBytes...) + supplierAddrBz := []byte(supplierAddr) + key = append(key, supplierAddrBz...) key = append(key, []byte("/")...) return key diff --git a/x/supplier/types/keys.go b/x/supplier/types/keys.go index fe2ebecc7..4c3838de8 100644 --- a/x/supplier/types/keys.go +++ b/x/supplier/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_supplier" ) -var ( - ParamsKey = []byte("p_supplier") -) +var ParamsKey = []byte("p_supplier") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go index 44589187d..535fa0d57 100644 --- a/x/supplier/types/message_stake_supplier.go +++ b/x/supplier/types/message_stake_supplier.go @@ -9,7 +9,7 @@ import ( const TypeMsgStakeSupplier = "stake_supplier" -var _ sdk.Msg = &MsgStakeSupplier{} +var _ sdk.Msg = (*MsgStakeSupplier)(nil) func NewMsgStakeSupplier( address string, diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go index 76798c98a..1a340fae8 100644 --- a/x/supplier/types/message_stake_supplier_test.go +++ b/x/supplier/types/message_stake_supplier_test.go @@ -5,13 +5,15 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - - "github.com/stretchr/testify/require" ) +// TODO_CLEANUP: This test has a lot of copy-pasted code from test to test. +// It can be simplified by splitting it into smaller tests where the common +// fields don't need to be explicitly specified from test to test. func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { defaultServicesList := []*sharedtypes.SupplierServiceConfig{ { @@ -28,74 +30,74 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }} tests := []struct { - name string - msg MsgStakeSupplier - err error + desc string + msg MsgStakeSupplier + expectedErr error }{ // address related tests { - name: "invalid address - nil stake", + desc: "invalid address - nil stake", msg: MsgStakeSupplier{ Address: "invalid_address", - // Stake explicitly nil + // Stake explicitly omitted Services: defaultServicesList, }, - err: ErrSupplierInvalidAddress, + expectedErr: ErrSupplierInvalidAddress, }, // stake related tests { - name: "valid address - nil stake", + desc: "valid address - nil stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), - // Stake explicitly nil + // Stake explicitly omitted Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - valid stake", + desc: "valid address - valid stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: defaultServicesList, }, }, { - name: "valid address - zero stake", + desc: "valid address - zero stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - negative stake", + desc: "valid address - negative stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - invalid stake denom", + desc: "valid address - invalid stake denom", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - invalid stake missing denom", + desc: "valid address - invalid stake missing denom", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, // service related tests { - name: "valid service configs - multiple services", + desc: "valid service configs - multiple services", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -128,25 +130,25 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, { - name: "invalid service configs - omitted", + desc: "invalid service configs - omitted", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, - // Services: intentionally omitted + // Services explicitly omitted }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - empty", + desc: "invalid service configs - empty", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{}, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid service ID that's too long", + desc: "invalid service configs - invalid service ID that's too long", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -165,10 +167,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid service Name that's too long", + desc: "invalid service configs - invalid service Name that's too long", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -188,10 +190,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid service ID that contains invalid characters", + desc: "invalid service configs - invalid service ID that contains invalid characters", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -210,10 +212,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - missing url", + desc: "invalid service configs - missing url", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -225,7 +227,7 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, Endpoints: []*sharedtypes.SupplierEndpoint{ { - // Url: intentionally omitted + // Url explicitly omitted RpcType: sharedtypes.RPCType_JSON_RPC, Configs: make([]*sharedtypes.ConfigOption, 0), }, @@ -233,10 +235,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid url", + desc: "invalid service configs - invalid url", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -256,10 +258,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - missing rpc type", + desc: "invalid service configs - missing rpc type", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -272,23 +274,23 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Endpoints: []*sharedtypes.SupplierEndpoint{ { Url: "http://localhost:8080", - // RpcType: intentionally omitted, + // RpcType explicitly omitted, Configs: make([]*sharedtypes.ConfigOption, 0), }, }, }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, // TODO_TEST: Need to add more tests around config types } - 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/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go index 4a5226ee5..245317ebf 100644 --- a/x/supplier/types/message_unstake_supplier.go +++ b/x/supplier/types/message_unstake_supplier.go @@ -1,12 +1,10 @@ package types -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" const TypeMsgUnstakeSupplier = "unstake_supplier" -var _ sdk.Msg = &MsgUnstakeSupplier{} +var _ sdk.Msg = (*MsgUnstakeSupplier)(nil) func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { return &MsgUnstakeSupplier{ diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go index b447397ed..b99a9186e 100644 --- a/x/supplier/types/message_unstake_supplier_test.go +++ b/x/supplier/types/message_unstake_supplier_test.go @@ -10,32 +10,32 @@ import ( func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUnstakeSupplier - err error + desc string + msg MsgUnstakeSupplier + expectedErr error }{ { - name: "invalid address", + desc: "invalid address", msg: MsgUnstakeSupplier{ Address: "invalid_address", }, - err: ErrSupplierInvalidAddress, + expectedErr: ErrSupplierInvalidAddress, }, { - name: "missing address", - msg: MsgUnstakeSupplier{}, - err: ErrSupplierInvalidAddress, + desc: "missing address", + msg: MsgUnstakeSupplier{}, + expectedErr: ErrSupplierInvalidAddress, }, { - name: "valid address", + desc: "valid address", msg: MsgUnstakeSupplier{ 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/supplier/types/msg_update_params.go b/x/supplier/types/message_update_params.go similarity index 91% rename from x/supplier/types/msg_update_params.go rename to x/supplier/types/message_update_params.go index e36d023de..aeed4a633 100644 --- a/x/supplier/types/msg_update_params.go +++ b/x/supplier/types/message_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 { diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go index 4f3215e35..95b0cf8a2 100644 --- a/x/supplier/types/params.go +++ b/x/supplier/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) diff --git a/x/supplier/types/types.go b/x/supplier/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/supplier/types/types.go +++ b/x/supplier/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs