From 594d6b71358b066b35c5d3e517e5d8978dcbf04b Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 17 Sep 2024 17:27:47 -0400 Subject: [PATCH 01/35] init proto --- proto/connect/marketmap/v2/tx.proto | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/proto/connect/marketmap/v2/tx.proto b/proto/connect/marketmap/v2/tx.proto index 6c479f3b4..0b404e8da 100644 --- a/proto/connect/marketmap/v2/tx.proto +++ b/proto/connect/marketmap/v2/tx.proto @@ -33,6 +33,11 @@ service Msg { // Specifically if a market does not exist it will be created, otherwise it // will be updated. The response will be a map between ticker -> updated. rpc UpsertMarkets(MsgUpsertMarkets) returns (MsgUpsertMarketsResponse); + + // RemoveMarkets removes the given markets from the marketmap if: + // - they exist in the map + // - they are disabled + rpc RemoveMarkets(MsgRemoveMarkets) returns (MsgRemoveMarketsResponse); } // MsgUpsertMarkets defines a message carrying a payload for performing market @@ -134,3 +139,20 @@ message MsgRemoveMarketAuthorities { // MsgRemoveMarketAuthoritiesResponse defines the // Msg/RemoveMarketAuthoritiesResponse response type. message MsgRemoveMarketAuthoritiesResponse {} + +// MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the new markets to be removed from the +// market map. +message MsgRemoveMarkets { + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Markets is the list of markets to remove. + repeated string markets = 2; +} + +// MsgRemoveMarketsResponse defines the +// Msg/MsgRemoveMarketsResponse response type. +message MsgRemoveMarketsResponse {} From c22b466e803e478b659abdb7390aa6808fcdf988 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 17 Sep 2024 17:29:42 -0400 Subject: [PATCH 02/35] gen proto: --- api/connect/marketmap/v2/tx.pulsar.go | 1148 ++++++++++++++++++++++-- api/connect/marketmap/v2/tx_grpc.pb.go | 44 + proto/connect/marketmap/v2/tx.proto | 4 +- x/marketmap/types/tx.pb.go | 485 +++++++++- 4 files changed, 1570 insertions(+), 111 deletions(-) diff --git a/api/connect/marketmap/v2/tx.pulsar.go b/api/connect/marketmap/v2/tx.pulsar.go index 093ac59f4..8c5b5f453 100644 --- a/api/connect/marketmap/v2/tx.pulsar.go +++ b/api/connect/marketmap/v2/tx.pulsar.go @@ -4809,6 +4809,906 @@ func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) ProtoMethods() *prot } } +var _ protoreflect.List = (*_MsgRemoveMarkets_2_list)(nil) + +type _MsgRemoveMarkets_2_list struct { + list *[]string +} + +func (x *_MsgRemoveMarkets_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgRemoveMarkets_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_MsgRemoveMarkets_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgRemoveMarkets_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgRemoveMarkets_2_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveMarkets at list field Markets as it is not of Message kind")) +} + +func (x *_MsgRemoveMarkets_2_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgRemoveMarkets_2_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_MsgRemoveMarkets_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgRemoveMarkets protoreflect.MessageDescriptor + fd_MsgRemoveMarkets_authority protoreflect.FieldDescriptor + fd_MsgRemoveMarkets_markets protoreflect.FieldDescriptor +) + +func init() { + file_connect_marketmap_v2_tx_proto_init() + md_MsgRemoveMarkets = File_connect_marketmap_v2_tx_proto.Messages().ByName("MsgRemoveMarkets") + fd_MsgRemoveMarkets_authority = md_MsgRemoveMarkets.Fields().ByName("authority") + fd_MsgRemoveMarkets_markets = md_MsgRemoveMarkets.Fields().ByName("markets") +} + +var _ protoreflect.Message = (*fastReflection_MsgRemoveMarkets)(nil) + +type fastReflection_MsgRemoveMarkets MsgRemoveMarkets + +func (x *MsgRemoveMarkets) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgRemoveMarkets)(x) +} + +func (x *MsgRemoveMarkets) slowProtoReflect() protoreflect.Message { + mi := &file_connect_marketmap_v2_tx_proto_msgTypes[10] + 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_MsgRemoveMarkets_messageType fastReflection_MsgRemoveMarkets_messageType +var _ protoreflect.MessageType = fastReflection_MsgRemoveMarkets_messageType{} + +type fastReflection_MsgRemoveMarkets_messageType struct{} + +func (x fastReflection_MsgRemoveMarkets_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgRemoveMarkets)(nil) +} +func (x fastReflection_MsgRemoveMarkets_messageType) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarkets) +} +func (x fastReflection_MsgRemoveMarkets_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarkets +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgRemoveMarkets) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarkets +} + +// 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_MsgRemoveMarkets) Type() protoreflect.MessageType { + return _fastReflection_MsgRemoveMarkets_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgRemoveMarkets) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarkets) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgRemoveMarkets) Interface() protoreflect.ProtoMessage { + return (*MsgRemoveMarkets)(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_MsgRemoveMarkets) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgRemoveMarkets_authority, value) { + return + } + } + if len(x.Markets) != 0 { + value := protoreflect.ValueOfList(&_MsgRemoveMarkets_2_list{list: &x.Markets}) + if !f(fd_MsgRemoveMarkets_markets, 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_MsgRemoveMarkets) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarkets.authority": + return x.Authority != "" + case "connect.marketmap.v2.MsgRemoveMarkets.markets": + return len(x.Markets) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarkets 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_MsgRemoveMarkets) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarkets.authority": + x.Authority = "" + case "connect.marketmap.v2.MsgRemoveMarkets.markets": + x.Markets = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarkets 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_MsgRemoveMarkets) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "connect.marketmap.v2.MsgRemoveMarkets.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "connect.marketmap.v2.MsgRemoveMarkets.markets": + if len(x.Markets) == 0 { + return protoreflect.ValueOfList(&_MsgRemoveMarkets_2_list{}) + } + listValue := &_MsgRemoveMarkets_2_list{list: &x.Markets} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarkets 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_MsgRemoveMarkets) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarkets.authority": + x.Authority = value.Interface().(string) + case "connect.marketmap.v2.MsgRemoveMarkets.markets": + lv := value.List() + clv := lv.(*_MsgRemoveMarkets_2_list) + x.Markets = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarkets 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_MsgRemoveMarkets) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarkets.markets": + if x.Markets == nil { + x.Markets = []string{} + } + value := &_MsgRemoveMarkets_2_list{list: &x.Markets} + return protoreflect.ValueOfList(value) + case "connect.marketmap.v2.MsgRemoveMarkets.authority": + panic(fmt.Errorf("field authority of message connect.marketmap.v2.MsgRemoveMarkets is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarkets 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_MsgRemoveMarkets) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarkets.authority": + return protoreflect.ValueOfString("") + case "connect.marketmap.v2.MsgRemoveMarkets.markets": + list := []string{} + return protoreflect.ValueOfList(&_MsgRemoveMarkets_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarkets 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_MsgRemoveMarkets) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in connect.marketmap.v2.MsgRemoveMarkets", 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_MsgRemoveMarkets) 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_MsgRemoveMarkets) 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_MsgRemoveMarkets) 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_MsgRemoveMarkets) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgRemoveMarkets) + 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 len(x.Markets) > 0 { + for _, s := range x.Markets { + l = len(s) + 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().(*MsgRemoveMarkets) + 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.Markets) > 0 { + for iNdEx := len(x.Markets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Markets[iNdEx]) + copy(dAtA[i:], x.Markets[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Markets[iNdEx]))) + 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().(*MsgRemoveMarkets) + 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: MsgRemoveMarkets: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarkets: 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 Markets", 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.Markets = append(x.Markets, 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_MsgRemoveMarketsResponse protoreflect.MessageDescriptor +) + +func init() { + file_connect_marketmap_v2_tx_proto_init() + md_MsgRemoveMarketsResponse = File_connect_marketmap_v2_tx_proto.Messages().ByName("MsgRemoveMarketsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketsResponse)(nil) + +type fastReflection_MsgRemoveMarketsResponse MsgRemoveMarketsResponse + +func (x *MsgRemoveMarketsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgRemoveMarketsResponse)(x) +} + +func (x *MsgRemoveMarketsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_connect_marketmap_v2_tx_proto_msgTypes[11] + 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_MsgRemoveMarketsResponse_messageType fastReflection_MsgRemoveMarketsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgRemoveMarketsResponse_messageType{} + +type fastReflection_MsgRemoveMarketsResponse_messageType struct{} + +func (x fastReflection_MsgRemoveMarketsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgRemoveMarketsResponse)(nil) +} +func (x fastReflection_MsgRemoveMarketsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarketsResponse) +} +func (x fastReflection_MsgRemoveMarketsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarketsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgRemoveMarketsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarketsResponse +} + +// 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_MsgRemoveMarketsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgRemoveMarketsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgRemoveMarketsResponse) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarketsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgRemoveMarketsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgRemoveMarketsResponse)(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_MsgRemoveMarketsResponse) 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_MsgRemoveMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarketsResponse 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_MsgRemoveMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarketsResponse 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_MsgRemoveMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarketsResponse 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_MsgRemoveMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarketsResponse 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_MsgRemoveMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarketsResponse 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_MsgRemoveMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) + } + panic(fmt.Errorf("message connect.marketmap.v2.MsgRemoveMarketsResponse 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_MsgRemoveMarketsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in connect.marketmap.v2.MsgRemoveMarketsResponse", 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_MsgRemoveMarketsResponse) 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_MsgRemoveMarketsResponse) 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_MsgRemoveMarketsResponse) 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_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgRemoveMarketsResponse) + 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().(*MsgRemoveMarketsResponse) + 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().(*MsgRemoveMarketsResponse) + 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: MsgRemoveMarketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketsResponse: 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 @@ -5218,6 +6118,82 @@ func (*MsgRemoveMarketAuthoritiesResponse) Descriptor() ([]byte, []int) { return file_connect_marketmap_v2_tx_proto_rawDescGZIP(), []int{9} } +// MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the +// new markets to be removed from the market map. +type MsgRemoveMarkets struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // Markets is the list of markets to remove. + Markets []string `protobuf:"bytes,2,rep,name=markets,proto3" json:"markets,omitempty"` +} + +func (x *MsgRemoveMarkets) Reset() { + *x = MsgRemoveMarkets{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_marketmap_v2_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRemoveMarkets) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRemoveMarkets) ProtoMessage() {} + +// Deprecated: Use MsgRemoveMarkets.ProtoReflect.Descriptor instead. +func (*MsgRemoveMarkets) Descriptor() ([]byte, []int) { + return file_connect_marketmap_v2_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgRemoveMarkets) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgRemoveMarkets) GetMarkets() []string { + if x != nil { + return x.Markets + } + return nil +} + +// MsgRemoveMarketsResponse defines the +// Msg/MsgRemoveMarketsResponse response type. +type MsgRemoveMarketsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgRemoveMarketsResponse) Reset() { + *x = MsgRemoveMarketsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_marketmap_v2_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRemoveMarketsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRemoveMarketsResponse) ProtoMessage() {} + +// Deprecated: Use MsgRemoveMarketsResponse.ProtoReflect.Descriptor instead. +func (*MsgRemoveMarketsResponse) Descriptor() ([]byte, []int) { + return file_connect_marketmap_v2_tx_proto_rawDescGZIP(), []int{11} +} + var File_connect_marketmap_v2_tx_proto protoreflect.FileDescriptor var file_connect_marketmap_v2_tx_proto_rawDesc = []byte{ @@ -5311,55 +6287,71 @@ var file_connect_marketmap_v2_tx_proto_rawDesc = []byte{ 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x24, 0x0a, 0x22, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa9, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x67, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, - 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, - 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, - 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, - 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x38, 0x2e, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, - 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x74, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 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, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x0e, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1a, + 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x92, 0x05, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, - 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, + 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, - 0x32, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2f, 0x76, 0x32, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x32, 0xa2, - 0x02, 0x03, 0x43, 0x4d, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x14, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x32, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x38, 0x2e, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, + 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x67, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, + 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, + 0xc8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x32, 0x3b, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, + 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x32, 0xe2, 0x02, + 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -5374,7 +6366,7 @@ func file_connect_marketmap_v2_tx_proto_rawDescGZIP() []byte { return file_connect_marketmap_v2_tx_proto_rawDescData } -var file_connect_marketmap_v2_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_connect_marketmap_v2_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_connect_marketmap_v2_tx_proto_goTypes = []interface{}{ (*MsgUpsertMarkets)(nil), // 0: connect.marketmap.v2.MsgUpsertMarkets (*MsgUpsertMarketsResponse)(nil), // 1: connect.marketmap.v2.MsgUpsertMarketsResponse @@ -5386,28 +6378,32 @@ var file_connect_marketmap_v2_tx_proto_goTypes = []interface{}{ (*MsgParamsResponse)(nil), // 7: connect.marketmap.v2.MsgParamsResponse (*MsgRemoveMarketAuthorities)(nil), // 8: connect.marketmap.v2.MsgRemoveMarketAuthorities (*MsgRemoveMarketAuthoritiesResponse)(nil), // 9: connect.marketmap.v2.MsgRemoveMarketAuthoritiesResponse - nil, // 10: connect.marketmap.v2.MsgUpsertMarketsResponse.MarketUpdatesEntry - (*Market)(nil), // 11: connect.marketmap.v2.Market - (*Params)(nil), // 12: connect.marketmap.v2.Params + (*MsgRemoveMarkets)(nil), // 10: connect.marketmap.v2.MsgRemoveMarkets + (*MsgRemoveMarketsResponse)(nil), // 11: connect.marketmap.v2.MsgRemoveMarketsResponse + nil, // 12: connect.marketmap.v2.MsgUpsertMarketsResponse.MarketUpdatesEntry + (*Market)(nil), // 13: connect.marketmap.v2.Market + (*Params)(nil), // 14: connect.marketmap.v2.Params } var file_connect_marketmap_v2_tx_proto_depIdxs = []int32{ - 11, // 0: connect.marketmap.v2.MsgUpsertMarkets.markets:type_name -> connect.marketmap.v2.Market - 10, // 1: connect.marketmap.v2.MsgUpsertMarketsResponse.market_updates:type_name -> connect.marketmap.v2.MsgUpsertMarketsResponse.MarketUpdatesEntry - 11, // 2: connect.marketmap.v2.MsgCreateMarkets.create_markets:type_name -> connect.marketmap.v2.Market - 11, // 3: connect.marketmap.v2.MsgUpdateMarkets.update_markets:type_name -> connect.marketmap.v2.Market - 12, // 4: connect.marketmap.v2.MsgParams.params:type_name -> connect.marketmap.v2.Params + 13, // 0: connect.marketmap.v2.MsgUpsertMarkets.markets:type_name -> connect.marketmap.v2.Market + 12, // 1: connect.marketmap.v2.MsgUpsertMarketsResponse.market_updates:type_name -> connect.marketmap.v2.MsgUpsertMarketsResponse.MarketUpdatesEntry + 13, // 2: connect.marketmap.v2.MsgCreateMarkets.create_markets:type_name -> connect.marketmap.v2.Market + 13, // 3: connect.marketmap.v2.MsgUpdateMarkets.update_markets:type_name -> connect.marketmap.v2.Market + 14, // 4: connect.marketmap.v2.MsgParams.params:type_name -> connect.marketmap.v2.Params 2, // 5: connect.marketmap.v2.Msg.CreateMarkets:input_type -> connect.marketmap.v2.MsgCreateMarkets 4, // 6: connect.marketmap.v2.Msg.UpdateMarkets:input_type -> connect.marketmap.v2.MsgUpdateMarkets 6, // 7: connect.marketmap.v2.Msg.UpdateParams:input_type -> connect.marketmap.v2.MsgParams 8, // 8: connect.marketmap.v2.Msg.RemoveMarketAuthorities:input_type -> connect.marketmap.v2.MsgRemoveMarketAuthorities 0, // 9: connect.marketmap.v2.Msg.UpsertMarkets:input_type -> connect.marketmap.v2.MsgUpsertMarkets - 3, // 10: connect.marketmap.v2.Msg.CreateMarkets:output_type -> connect.marketmap.v2.MsgCreateMarketsResponse - 5, // 11: connect.marketmap.v2.Msg.UpdateMarkets:output_type -> connect.marketmap.v2.MsgUpdateMarketsResponse - 7, // 12: connect.marketmap.v2.Msg.UpdateParams:output_type -> connect.marketmap.v2.MsgParamsResponse - 9, // 13: connect.marketmap.v2.Msg.RemoveMarketAuthorities:output_type -> connect.marketmap.v2.MsgRemoveMarketAuthoritiesResponse - 1, // 14: connect.marketmap.v2.Msg.UpsertMarkets:output_type -> connect.marketmap.v2.MsgUpsertMarketsResponse - 10, // [10:15] is the sub-list for method output_type - 5, // [5:10] is the sub-list for method input_type + 10, // 10: connect.marketmap.v2.Msg.RemoveMarkets:input_type -> connect.marketmap.v2.MsgRemoveMarkets + 3, // 11: connect.marketmap.v2.Msg.CreateMarkets:output_type -> connect.marketmap.v2.MsgCreateMarketsResponse + 5, // 12: connect.marketmap.v2.Msg.UpdateMarkets:output_type -> connect.marketmap.v2.MsgUpdateMarketsResponse + 7, // 13: connect.marketmap.v2.Msg.UpdateParams:output_type -> connect.marketmap.v2.MsgParamsResponse + 9, // 14: connect.marketmap.v2.Msg.RemoveMarketAuthorities:output_type -> connect.marketmap.v2.MsgRemoveMarketAuthoritiesResponse + 1, // 15: connect.marketmap.v2.Msg.UpsertMarkets:output_type -> connect.marketmap.v2.MsgUpsertMarketsResponse + 11, // 16: connect.marketmap.v2.Msg.RemoveMarkets:output_type -> connect.marketmap.v2.MsgRemoveMarketsResponse + 11, // [11:17] is the sub-list for method output_type + 5, // [5:11] 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 @@ -5541,6 +6537,30 @@ func file_connect_marketmap_v2_tx_proto_init() { return nil } } + file_connect_marketmap_v2_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRemoveMarkets); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_marketmap_v2_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRemoveMarketsResponse); 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{ @@ -5548,7 +6568,7 @@ func file_connect_marketmap_v2_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_connect_marketmap_v2_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 1, }, diff --git a/api/connect/marketmap/v2/tx_grpc.pb.go b/api/connect/marketmap/v2/tx_grpc.pb.go index 232d972e3..e63b8d023 100644 --- a/api/connect/marketmap/v2/tx_grpc.pb.go +++ b/api/connect/marketmap/v2/tx_grpc.pb.go @@ -24,6 +24,7 @@ const ( Msg_UpdateParams_FullMethodName = "/connect.marketmap.v2.Msg/UpdateParams" Msg_RemoveMarketAuthorities_FullMethodName = "/connect.marketmap.v2.Msg/RemoveMarketAuthorities" Msg_UpsertMarkets_FullMethodName = "/connect.marketmap.v2.Msg/UpsertMarkets" + Msg_RemoveMarkets_FullMethodName = "/connect.marketmap.v2.Msg/RemoveMarkets" ) // MsgClient is the client API for Msg service. @@ -46,6 +47,10 @@ type MsgClient interface { // Specifically if a market does not exist it will be created, otherwise it // will be updated. The response will be a map between ticker -> updated. UpsertMarkets(ctx context.Context, in *MsgUpsertMarkets, opts ...grpc.CallOption) (*MsgUpsertMarketsResponse, error) + // RemoveMarkets removes the given markets from the marketmap if: + // - they exist in the map + // - they are disabled + RemoveMarkets(ctx context.Context, in *MsgRemoveMarkets, opts ...grpc.CallOption) (*MsgRemoveMarketsResponse, error) } type msgClient struct { @@ -106,6 +111,16 @@ func (c *msgClient) UpsertMarkets(ctx context.Context, in *MsgUpsertMarkets, opt return out, nil } +func (c *msgClient) RemoveMarkets(ctx context.Context, in *MsgRemoveMarkets, opts ...grpc.CallOption) (*MsgRemoveMarketsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgRemoveMarketsResponse) + err := c.cc.Invoke(ctx, Msg_RemoveMarkets_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility. @@ -126,6 +141,10 @@ type MsgServer interface { // Specifically if a market does not exist it will be created, otherwise it // will be updated. The response will be a map between ticker -> updated. UpsertMarkets(context.Context, *MsgUpsertMarkets) (*MsgUpsertMarketsResponse, error) + // RemoveMarkets removes the given markets from the marketmap if: + // - they exist in the map + // - they are disabled + RemoveMarkets(context.Context, *MsgRemoveMarkets) (*MsgRemoveMarketsResponse, error) mustEmbedUnimplementedMsgServer() } @@ -151,6 +170,9 @@ func (UnimplementedMsgServer) RemoveMarketAuthorities(context.Context, *MsgRemov func (UnimplementedMsgServer) UpsertMarkets(context.Context, *MsgUpsertMarkets) (*MsgUpsertMarketsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpsertMarkets not implemented") } +func (UnimplementedMsgServer) RemoveMarkets(context.Context, *MsgRemoveMarkets) (*MsgRemoveMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveMarkets not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} func (UnimplementedMsgServer) testEmbeddedByValue() {} @@ -262,6 +284,24 @@ func _Msg_UpsertMarkets_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_RemoveMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveMarkets) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveMarkets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_RemoveMarkets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveMarkets(ctx, req.(*MsgRemoveMarkets)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -289,6 +329,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpsertMarkets", Handler: _Msg_UpsertMarkets_Handler, }, + { + MethodName: "RemoveMarkets", + Handler: _Msg_RemoveMarkets_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "connect/marketmap/v2/tx.proto", diff --git a/proto/connect/marketmap/v2/tx.proto b/proto/connect/marketmap/v2/tx.proto index 0b404e8da..886ef9694 100644 --- a/proto/connect/marketmap/v2/tx.proto +++ b/proto/connect/marketmap/v2/tx.proto @@ -140,8 +140,8 @@ message MsgRemoveMarketAuthorities { // Msg/RemoveMarketAuthoritiesResponse response type. message MsgRemoveMarketAuthoritiesResponse {} -// MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the new markets to be removed from the -// market map. +// MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the +// new markets to be removed from the market map. message MsgRemoveMarkets { option (cosmos.msg.v1.signer) = "authority"; diff --git a/x/marketmap/types/tx.pb.go b/x/marketmap/types/tx.pb.go index 4ac98b190..6dee61f30 100644 --- a/x/marketmap/types/tx.pb.go +++ b/x/marketmap/types/tx.pb.go @@ -516,6 +516,101 @@ func (m *MsgRemoveMarketAuthoritiesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse proto.InternalMessageInfo +// MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the +// new markets to be removed from the market map. +type MsgRemoveMarkets struct { + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // Markets is the list of markets to remove. + Markets []string `protobuf:"bytes,2,rep,name=markets,proto3" json:"markets,omitempty"` +} + +func (m *MsgRemoveMarkets) Reset() { *m = MsgRemoveMarkets{} } +func (m *MsgRemoveMarkets) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMarkets) ProtoMessage() {} +func (*MsgRemoveMarkets) Descriptor() ([]byte, []int) { + return fileDescriptor_37df9476ca9a2f81, []int{10} +} +func (m *MsgRemoveMarkets) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveMarkets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveMarkets.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveMarkets) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMarkets.Merge(m, src) +} +func (m *MsgRemoveMarkets) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveMarkets) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMarkets.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveMarkets proto.InternalMessageInfo + +func (m *MsgRemoveMarkets) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgRemoveMarkets) GetMarkets() []string { + if m != nil { + return m.Markets + } + return nil +} + +// MsgRemoveMarketsResponse defines the +// Msg/MsgRemoveMarketsResponse response type. +type MsgRemoveMarketsResponse struct { +} + +func (m *MsgRemoveMarketsResponse) Reset() { *m = MsgRemoveMarketsResponse{} } +func (m *MsgRemoveMarketsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMarketsResponse) ProtoMessage() {} +func (*MsgRemoveMarketsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_37df9476ca9a2f81, []int{11} +} +func (m *MsgRemoveMarketsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveMarketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveMarketsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveMarketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMarketsResponse.Merge(m, src) +} +func (m *MsgRemoveMarketsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveMarketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMarketsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveMarketsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpsertMarkets)(nil), "connect.marketmap.v2.MsgUpsertMarkets") proto.RegisterType((*MsgUpsertMarketsResponse)(nil), "connect.marketmap.v2.MsgUpsertMarketsResponse") @@ -528,56 +623,60 @@ func init() { proto.RegisterType((*MsgParamsResponse)(nil), "connect.marketmap.v2.MsgParamsResponse") proto.RegisterType((*MsgRemoveMarketAuthorities)(nil), "connect.marketmap.v2.MsgRemoveMarketAuthorities") proto.RegisterType((*MsgRemoveMarketAuthoritiesResponse)(nil), "connect.marketmap.v2.MsgRemoveMarketAuthoritiesResponse") + proto.RegisterType((*MsgRemoveMarkets)(nil), "connect.marketmap.v2.MsgRemoveMarkets") + proto.RegisterType((*MsgRemoveMarketsResponse)(nil), "connect.marketmap.v2.MsgRemoveMarketsResponse") } func init() { proto.RegisterFile("connect/marketmap/v2/tx.proto", fileDescriptor_37df9476ca9a2f81) } var fileDescriptor_37df9476ca9a2f81 = []byte{ - // 690 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xbf, 0x6f, 0xd3, 0x4e, - 0x14, 0xcf, 0xa5, 0x3f, 0xbe, 0xdf, 0x1c, 0xa4, 0xb4, 0x47, 0xa4, 0x1a, 0x0b, 0x9c, 0x62, 0x55, - 0xa5, 0x54, 0xaa, 0x5d, 0x82, 0x84, 0x2a, 0xc3, 0x40, 0x82, 0x18, 0x40, 0x8a, 0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, 0x08, 0x79, 0x75, 0xd4, 0x88, 0x7c, 0x29, 0xfb, 0xbf, 0x43, 0x0b, 0xc3, 0xbd, 0xcf, 0xe7, - 0x96, 0x72, 0xc0, 0x3b, 0x2e, 0x4f, 0xbc, 0x3a, 0xde, 0x5d, 0x02, 0xad, 0xa7, 0x7b, 0x87, 0x0a, - 0xd8, 0x3f, 0x54, 0xc0, 0xcf, 0x43, 0x05, 0x7c, 0x38, 0x52, 0x4a, 0xfb, 0x47, 0x4a, 0xe9, 0xfb, - 0x91, 0x52, 0x7a, 0xb9, 0xe2, 0x7a, 0x6c, 0xa3, 0xbb, 0xae, 0xd9, 0xc4, 0xd7, 0xe9, 0xa6, 0x17, - 0x2e, 0xfb, 0x38, 0xd6, 0xd3, 0x71, 0x8f, 0x1b, 0xb9, 0x89, 0x67, 0x3b, 0x21, 0xa6, 0xeb, 0x93, - 0xc9, 0xe7, 0xf4, 0xee, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0xbc, 0x2f, 0xbc, 0x28, 0x08, - 0x00, 0x00, + // 725 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, + 0x14, 0xef, 0x14, 0x8a, 0xf6, 0x69, 0x11, 0xd6, 0x26, 0xac, 0x1b, 0x6d, 0x71, 0x43, 0x2a, 0x92, + 0xb0, 0x8b, 0x35, 0x31, 0xa4, 0x7a, 0xb0, 0x35, 0x1e, 0x34, 0x69, 0x62, 0xd6, 0x90, 0x18, 0x2f, + 0xcd, 0xd2, 0x4e, 0x96, 0x0d, 0xec, 0x9f, 0xec, 0x4c, 0x37, 0x70, 0x33, 0x1a, 0x2f, 0x5e, 0x34, + 0x9e, 0x3c, 0xea, 0x37, 0xe0, 0xe0, 0x57, 0x30, 0xe1, 0x48, 0x38, 0x79, 0x32, 0x06, 0x0e, 0xf8, + 0x31, 0x4c, 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c, 0xa1, 0xa5, 0x1c, 0xf4, 0x42, 0x59, 0x50, 0x10, 0x67, 0xb6, 0x32, + 0x12, 0xe7, 0x61, 0x81, 0x06, 0x4e, 0xa3, 0x92, 0x7b, 0x73, 0xbc, 0xbb, 0x84, 0x1a, 0xcf, 0xf7, + 0x0e, 0x4b, 0x68, 0xff, 0xb0, 0x84, 0x7e, 0x1f, 0x96, 0xd0, 0xa7, 0xa3, 0x52, 0x66, 0xff, 0xa8, + 0x94, 0xf9, 0x79, 0x54, 0xca, 0xbc, 0x5e, 0xb1, 0x6c, 0xba, 0xd1, 0x5d, 0xd7, 0xda, 0x9e, 0xa3, + 0x93, 0x4d, 0xdb, 0x5f, 0x76, 0x70, 0xa8, 0xc7, 0x9b, 0x2e, 0xac, 0x0a, 0xcb, 0x8e, 0xee, 0xf8, + 0x98, 0xac, 0x4f, 0x45, 0xbf, 0x24, 0xee, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x83, 0xa3, 0xed, + 0x6d, 0x23, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -606,6 +705,10 @@ type MsgClient interface { // Specifically if a market does not exist it will be created, otherwise it // will be updated. The response will be a map between ticker -> updated. UpsertMarkets(ctx context.Context, in *MsgUpsertMarkets, opts ...grpc.CallOption) (*MsgUpsertMarketsResponse, error) + // RemoveMarkets removes the given markets from the marketmap if: + // - they exist in the map + // - they are disabled + RemoveMarkets(ctx context.Context, in *MsgRemoveMarkets, opts ...grpc.CallOption) (*MsgRemoveMarketsResponse, error) } type msgClient struct { @@ -661,6 +764,15 @@ func (c *msgClient) UpsertMarkets(ctx context.Context, in *MsgUpsertMarkets, opt return out, nil } +func (c *msgClient) RemoveMarkets(ctx context.Context, in *MsgRemoveMarkets, opts ...grpc.CallOption) (*MsgRemoveMarketsResponse, error) { + out := new(MsgRemoveMarketsResponse) + err := c.cc.Invoke(ctx, "/connect.marketmap.v2.Msg/RemoveMarkets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateMarkets creates markets from the given message. @@ -677,6 +789,10 @@ type MsgServer interface { // Specifically if a market does not exist it will be created, otherwise it // will be updated. The response will be a map between ticker -> updated. UpsertMarkets(context.Context, *MsgUpsertMarkets) (*MsgUpsertMarketsResponse, error) + // RemoveMarkets removes the given markets from the marketmap if: + // - they exist in the map + // - they are disabled + RemoveMarkets(context.Context, *MsgRemoveMarkets) (*MsgRemoveMarketsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -698,6 +814,9 @@ func (*UnimplementedMsgServer) RemoveMarketAuthorities(ctx context.Context, req func (*UnimplementedMsgServer) UpsertMarkets(ctx context.Context, req *MsgUpsertMarkets) (*MsgUpsertMarketsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpsertMarkets not implemented") } +func (*UnimplementedMsgServer) RemoveMarkets(ctx context.Context, req *MsgRemoveMarkets) (*MsgRemoveMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveMarkets not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -793,6 +912,24 @@ func _Msg_UpsertMarkets_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_RemoveMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveMarkets) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveMarkets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/connect.marketmap.v2.Msg/RemoveMarkets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveMarkets(ctx, req.(*MsgRemoveMarkets)) + } + return interceptor(ctx, in, info, handler) +} + var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "connect.marketmap.v2.Msg", @@ -818,6 +955,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpsertMarkets", Handler: _Msg_UpsertMarkets_Handler, }, + { + MethodName: "RemoveMarkets", + Handler: _Msg_RemoveMarkets_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "connect/marketmap/v2/tx.proto", @@ -1176,6 +1317,68 @@ func (m *MsgRemoveMarketAuthoritiesResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } +func (m *MsgRemoveMarkets) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveMarkets) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveMarkets) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Markets) > 0 { + for iNdEx := len(m.Markets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Markets[iNdEx]) + copy(dAtA[i:], m.Markets[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Markets[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveMarketsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveMarketsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1331,6 +1534,34 @@ func (m *MsgRemoveMarketAuthoritiesResponse) Size() (n int) { return n } +func (m *MsgRemoveMarkets) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Markets) > 0 { + for _, s := range m.Markets { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgRemoveMarketsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2279,6 +2510,170 @@ func (m *MsgRemoveMarketAuthoritiesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRemoveMarkets) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveMarkets: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveMarkets: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Markets = append(m.Markets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveMarketsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveMarketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveMarketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 536406403879cf6022fb297a7cc075abee95894d Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:21:53 -0400 Subject: [PATCH 03/35] validate basic --- x/marketmap/types/msg.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/x/marketmap/types/msg.go b/x/marketmap/types/msg.go index 3f64dd570..7d2466ed2 100644 --- a/x/marketmap/types/msg.go +++ b/x/marketmap/types/msg.go @@ -2,6 +2,7 @@ package types import ( "fmt" + connecttypes "github.com/skip-mev/connect/v2/pkg/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -12,6 +13,7 @@ var ( _ sdk.Msg = &MsgParams{} _ sdk.Msg = &MsgRemoveMarketAuthorities{} _ sdk.Msg = &MsgUpsertMarkets{} + _ sdk.Msg = &MsgRemoveMarkets{} ) // ValidateBasic asserts that the authority address in the upsert-markets message is formatted correctly. @@ -124,3 +126,31 @@ func (m *MsgRemoveMarketAuthorities) ValidateBasic() error { return nil } + +// ValidateBasic determines whether the information in the message is formatted correctly, specifically +// whether the signer is a valid acc-address. +func (m *MsgRemoveMarkets) ValidateBasic() error { + // validate signer address + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return err + } + + if len(m.Markets) == 0 { + return fmt.Errorf("markets to remove cannot be nil") + } + + seenMarkets := make(map[string]struct{}, len(m.Markets)) + for _, market := range m.Markets { + if _, seen := seenMarkets[market]; seen { + return fmt.Errorf("duplicate address %s found", market) + } + + if _, err := connecttypes.CurrencyPairFromString(market); err != nil { + return fmt.Errorf("invalid market pair string: %w", err) + } + + seenMarkets[market] = struct{}{} + } + + return nil +} From e812c893ac9b6135556efccadc642112e152749d Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:24:29 -0400 Subject: [PATCH 04/35] test --- x/marketmap/types/msg_test.go | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/x/marketmap/types/msg_test.go b/x/marketmap/types/msg_test.go index fc22c2887..1652f025c 100644 --- a/x/marketmap/types/msg_test.go +++ b/x/marketmap/types/msg_test.go @@ -516,3 +516,64 @@ func TestValidateBasicMsgRemoveMarketAuthorities(t *testing.T) { }) } } + +func TestValidateBasicMsgRemoveMarkets(t *testing.T) { + rng := sample.Rand() + + tcs := []struct { + name string + msg types.MsgRemoveMarkets + expectPass bool + }{ + { + "if the Authority is not an acc-address - fail", + types.MsgRemoveMarkets{ + Authority: "invalid", + }, + false, + }, + { + name: "invalid message (no markets) - fail", + msg: types.MsgRemoveMarkets{ + Markets: nil, + Authority: sample.Address(rng), + }, + expectPass: false, + }, + { + name: "valid message - single market", + msg: types.MsgRemoveMarkets{ + Markets: []string{"USDT/USD"}, + Authority: sample.Address(rng), + }, + expectPass: true, + }, + { + name: "valid message - multiple markets", + msg: types.MsgRemoveMarkets{ + Markets: []string{"USDT/USD", "ETH/USD"}, + Authority: sample.Address(rng), + }, + expectPass: true, + }, + { + name: "invalid message (duplicate markets", + msg: types.MsgRemoveMarkets{ + Markets: []string{"USDT/USD", "USDT/USD"}, + Authority: sample.Address(rng), + }, + expectPass: false, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if !tc.expectPass { + require.NotNil(t, err) + } else { + require.Nil(t, err) + } + }) + } +} From 0d0e239d05324e226be933a05e61201b5b456064 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:25:34 -0400 Subject: [PATCH 05/35] interface registry --- x/marketmap/types/codec.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/marketmap/types/codec.go b/x/marketmap/types/codec.go index 00e2460f1..eb12e3b17 100644 --- a/x/marketmap/types/codec.go +++ b/x/marketmap/types/codec.go @@ -15,6 +15,9 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgCreateMarkets{}, "connect/x/marketmap/MsgCreateMarkets") legacy.RegisterAminoMsg(cdc, &MsgUpdateMarkets{}, "connect/x/marketmap/MsgUpdateMarkets") legacy.RegisterAminoMsg(cdc, &MsgParams{}, "connect/x/marketmap/MsgParams") + legacy.RegisterAminoMsg(cdc, &MsgUpsertMarkets{}, "connect/x/marketmap/MsgUpsertMarkets") + legacy.RegisterAminoMsg(cdc, &MsgRemoveMarkets{}, "connect/x/marketmap/MsgRemoveMarkets") + legacy.RegisterAminoMsg(cdc, &MsgRemoveMarketAuthorities{}, "connect/x/marketmap/MsgRemoveMarketAuthorities") } // RegisterInterfaces registers the x/marketmap messages + message service w/ the InterfaceRegistry (registry). @@ -24,6 +27,9 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgCreateMarkets{}, &MsgUpdateMarkets{}, &MsgParams{}, + &MsgUpsertMarkets{}, + &MsgRemoveMarkets{}, + &MsgRemoveMarketAuthorities{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) From 4ca8ad9d7c93bef314b72919b0ce578edefaabe7 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:40:37 -0400 Subject: [PATCH 06/35] delete enabled --- x/marketmap/keeper/keeper.go | 14 +++++++++++++- x/marketmap/keeper/keeper_test.go | 23 +++++++++++++++++++++++ x/marketmap/keeper/msg_server.go | 22 ++++++++++++++++++++++ x/marketmap/types/errors.go | 14 ++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index a9bbdc74e..dcb650a18 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -109,7 +109,6 @@ func (k *Keeper) GetAllMarkets(ctx sdk.Context) (map[string]types.Market, error) if err != nil { return nil, err } - m := make(map[string]types.Market, len(keyValues)) for _, keyValue := range keyValues { m[string(keyValue.Key)] = keyValue.Value @@ -163,6 +162,19 @@ func (k *Keeper) DeleteMarket(ctx sdk.Context, tickerStr string) error { return k.markets.Remove(ctx, types.TickerString(tickerStr)) } +// DeleteDisabledMarket removes a Market if it is disabled. +func (k *Keeper) DeleteDisabledMarket(ctx sdk.Context, tickerStr string) error { + // Check if Ticker exists + market, err := k.markets.Get(ctx, types.TickerString(tickerStr)) + if err != nil { + return err + } + if market.Ticker.Enabled { + return fmt.Errorf("cannot remove market: %w", types.NewMarketIsEnabled(types.TickerString(tickerStr))) + } + return k.markets.Remove(ctx, types.TickerString(tickerStr)) +} + // HasMarket checks if a market exists in the store. func (k *Keeper) HasMarket(ctx sdk.Context, tickerStr string) (bool, error) { return k.markets.Has(ctx, types.TickerString(tickerStr)) diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index e624b92a9..4aff581a8 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -334,6 +334,29 @@ func (s *KeeperTestSuite) TestDeleteMarket() { s.Require().Error(err) } +func (s *KeeperTestSuite) TestDeleteDisabledMarket() { + // create a valid markets + btcCopy := btcusdt + btcCopy.Ticker.Enabled = true + s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcCopy)) + + // invalid delete fails + s.Require().Error(s.keeper.DeleteDisabledMarket(s.ctx, "foobar")) + + // cannot delete enabled markets + s.Require().Error(s.keeper.DeleteDisabledMarket(s.ctx, btcCopy.Ticker.String())) + + // disable market + btcCopy.Ticker.Enabled = false + s.Require().NoError(s.keeper.UpdateMarket(s.ctx, btcCopy)) + + // delete disabled markets + s.Require().NoError(s.keeper.DeleteDisabledMarket(s.ctx, btcCopy.Ticker.String())) + _, err := s.keeper.GetMarket(s.ctx, btcCopy.Ticker.String()) + s.Require().Error(err) + +} + func (s *KeeperTestSuite) TestEnableDisableMarket() { // create a valid markets s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 044a07c5e..5c0dd406f 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -250,6 +250,28 @@ func (ms msgServer) RemoveMarketAuthorities(goCtx context.Context, msg *types.Ms return &types.MsgRemoveMarketAuthoritiesResponse{}, nil } +// RemoveMarkets attempts to remove all currently non-enabled markets from the market map. +func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMarkets) (*types.MsgRemoveMarketsResponse, + error) { + if msg == nil { + return nil, fmt.Errorf("unable to process nil msg") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // perform basic msg validity checks + if err := ms.verifyMarketAuthorities(ctx, msg); err != nil { + return nil, fmt.Errorf("unable to verify market authorities: %w", err) + } + + for _, market := range msg.Markets { + if err := ms.k.DeleteMarket(ctx, market); err != nil { + } + } + + return &types.MsgRemoveMarketsResponse{}, nil +} + // checkMarketAuthority checks if the given authority is the x/marketmap's list of MarketAuthorities. func checkMarketAuthority(authority string, params types.Params) bool { if len(params.MarketAuthorities) == 0 { diff --git a/x/marketmap/types/errors.go b/x/marketmap/types/errors.go index effcebcf3..ddc208f77 100644 --- a/x/marketmap/types/errors.go +++ b/x/marketmap/types/errors.go @@ -29,3 +29,17 @@ func NewMarketDoesNotExistsError(ticker TickerString) MarketDoesNotExistsError { func (e MarketDoesNotExistsError) Error() string { return fmt.Sprintf("market does not exist for ticker %s", e.ticker) } + +// MarketIsEnabledError is an error indicating the given Market does not exist in state. +type MarketIsEnabledError struct { + ticker TickerString +} + +func NewMarketIsEnabled(ticker TickerString) MarketIsEnabledError { + return MarketIsEnabledError{ticker: ticker} +} + +// Error returns the error string for MarketIsEnabledError. +func (e MarketIsEnabledError) Error() string { + return fmt.Sprintf("market is currently enabled %s", e.ticker) +} From 62776ab86b45f994fb8c532190e83610b0cd87fb Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:44:50 -0400 Subject: [PATCH 07/35] msg handler --- x/marketmap/keeper/keeper.go | 15 --------------- x/marketmap/keeper/keeper_test.go | 13 ------------- x/marketmap/keeper/msg_server.go | 14 +++++++++++++- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index dcb650a18..1f3b17ee8 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -147,21 +147,6 @@ func (k *Keeper) UpdateMarket(ctx sdk.Context, market types.Market) error { return k.setMarket(ctx, market) } -// DeleteMarket removes a Market. -// This is currently only expected to be called in upgrade handlers, and callers will need to separately call -// RemoveCurrencyPair on x/oracle to clean up leftover state in that module. -func (k *Keeper) DeleteMarket(ctx sdk.Context, tickerStr string) error { - // Check if Ticker exists - alreadyExists, err := k.markets.Has(ctx, types.TickerString(tickerStr)) - if err != nil { - return err - } - if !alreadyExists { - return types.NewMarketDoesNotExistsError(types.TickerString(tickerStr)) - } - return k.markets.Remove(ctx, types.TickerString(tickerStr)) -} - // DeleteDisabledMarket removes a Market if it is disabled. func (k *Keeper) DeleteDisabledMarket(ctx sdk.Context, tickerStr string) error { // Check if Ticker exists diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index 4aff581a8..6e709d8ef 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -321,19 +321,6 @@ func (s *KeeperTestSuite) TestInvalidCreateDisabledNormalizeBy() { s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) } -func (s *KeeperTestSuite) TestDeleteMarket() { - // create a valid markets - s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) - - // invalid delete fails - s.Require().Error(s.keeper.DeleteMarket(s.ctx, "foobar")) - - // valid delete works - s.Require().NoError(s.keeper.DeleteMarket(s.ctx, btcusdt.Ticker.String())) - _, err := s.keeper.GetMarket(s.ctx, btcusdt.Ticker.String()) - s.Require().Error(err) -} - func (s *KeeperTestSuite) TestDeleteDisabledMarket() { // create a valid markets btcCopy := btcusdt diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 5c0dd406f..70ce58153 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -265,10 +265,22 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar } for _, market := range msg.Markets { - if err := ms.k.DeleteMarket(ctx, market); err != nil { + if err := ms.k.DeleteDisabledMarket(ctx, market); err != nil { + return nil, fmt.Errorf("unable to delete market: %w", err) } } + // check if the resulting state is valid: it may not be valid if the removed market is used as a normalization pair + allMarkets, err := ms.k.GetAllMarkets(ctx) + if err != nil { + return nil, err + } + + mm := types.MarketMap{Markets: allMarkets} + if err := mm.ValidateBasic(); err != nil { + return nil, fmt.Errorf("invalid state resulting from removals: %w", err) + } + return &types.MsgRemoveMarketsResponse{}, nil } From fb64aedb2f8b3822b2be521e090f1ae9076ceba7 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:47:17 -0400 Subject: [PATCH 08/35] init test --- x/marketmap/keeper/msg_server_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index 6c47d8c5b..1f113649a 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -519,3 +519,23 @@ func (s *KeeperTestSuite) TestMsgServerUpsertMarkets() { s.Require().Nil(resp) }) } + +func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { + msgServer := keeper.NewMsgServer(s.keeper) + + s.Run("unable to process nil request", func() { + resp, err := msgServer.RemoveMarkets(s.ctx, nil) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("unable to process for invalid authority", func() { + msg := &types.MsgRemoveMarkets{ + Authority: "invalid", + } + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + +} From 8e0081e0f7425b6b9812a305649a9aff42730b8c Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:49:19 -0400 Subject: [PATCH 09/35] format --- x/marketmap/keeper/keeper_test.go | 1 - x/marketmap/keeper/msg_server.go | 3 ++- x/marketmap/keeper/msg_server_test.go | 1 - x/marketmap/types/msg.go | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index 6e709d8ef..b02527583 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -341,7 +341,6 @@ func (s *KeeperTestSuite) TestDeleteDisabledMarket() { s.Require().NoError(s.keeper.DeleteDisabledMarket(s.ctx, btcCopy.Ticker.String())) _, err := s.keeper.GetMarket(s.ctx, btcCopy.Ticker.String()) s.Require().Error(err) - } func (s *KeeperTestSuite) TestEnableDisableMarket() { diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 70ce58153..4c9c49a6d 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -252,7 +252,8 @@ func (ms msgServer) RemoveMarketAuthorities(goCtx context.Context, msg *types.Ms // RemoveMarkets attempts to remove all currently non-enabled markets from the market map. func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMarkets) (*types.MsgRemoveMarketsResponse, - error) { + error, +) { if msg == nil { return nil, fmt.Errorf("unable to process nil msg") } diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index 1f113649a..d9df59bad 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -537,5 +537,4 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Require().Error(err) s.Require().Nil(resp) }) - } diff --git a/x/marketmap/types/msg.go b/x/marketmap/types/msg.go index 7d2466ed2..c36d137f8 100644 --- a/x/marketmap/types/msg.go +++ b/x/marketmap/types/msg.go @@ -2,6 +2,7 @@ package types import ( "fmt" + connecttypes "github.com/skip-mev/connect/v2/pkg/types" sdk "github.com/cosmos/cosmos-sdk/types" From 0e550723b2faee71fc365f633cdc96c53a3a95c1 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:52:27 -0400 Subject: [PATCH 10/35] hooks and mocks --- x/marketmap/types/hooks.go | 18 +++++++++ x/marketmap/types/mocks/MarketMapHooks.go | 47 +++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/x/marketmap/types/hooks.go b/x/marketmap/types/hooks.go index 541e3e30f..90b70c769 100644 --- a/x/marketmap/types/hooks.go +++ b/x/marketmap/types/hooks.go @@ -14,6 +14,9 @@ type MarketMapHooks interface { // AfterMarketGenesis is called after x/marketmap init genesis. AfterMarketGenesis(ctx sdk.Context, tickers map[string]Market) error + + // AfterMarketRemoved is called after a market is removed. + AfterMarketRemoved(ctx sdk.Context, market Market) error } var _ MarketMapHooks = &MultiMarketMapHooks{} @@ -54,6 +57,17 @@ func (mh MultiMarketMapHooks) AfterMarketGenesis(ctx sdk.Context, markets map[st return nil } +// AfterMarketRemoved calls all AfterMarketRemoved hooks registered to the MultiMarketMapHooks. +func (mh MultiMarketMapHooks) AfterMarketRemoved(ctx sdk.Context, market Market) error { + for i := range mh { + if err := mh[i].AfterMarketRemoved(ctx, market); err != nil { + return err + } + } + + return nil +} + // MarketMapHooksWrapper is a wrapper for modules to inject MarketMapHooks using depinject. type MarketMapHooksWrapper struct{ MarketMapHooks } @@ -73,3 +87,7 @@ func (n *NoopMarketMapHooks) AfterMarketUpdated(_ sdk.Context, _ Market) error { func (n *NoopMarketMapHooks) AfterMarketGenesis(_ sdk.Context, _ map[string]Market) error { return nil } + +func (n *NoopMarketMapHooks) AfterMarketRemoved(_ sdk.Context, _ Market) error { + return nil +} diff --git a/x/marketmap/types/mocks/MarketMapHooks.go b/x/marketmap/types/mocks/MarketMapHooks.go index d001659af..20661e446 100644 --- a/x/marketmap/types/mocks/MarketMapHooks.go +++ b/x/marketmap/types/mocks/MarketMapHooks.go @@ -117,6 +117,53 @@ func (_c *MarketMapHooks_AfterMarketGenesis_Call) RunAndReturn(run func(types.Co return _c } +// AfterMarketRemoved provides a mock function with given fields: ctx, market +func (_m *MarketMapHooks) AfterMarketRemoved(ctx types.Context, market marketmaptypes.Market) error { + ret := _m.Called(ctx, market) + + if len(ret) == 0 { + panic("no return value specified for AfterMarketRemoved") + } + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, marketmaptypes.Market) error); ok { + r0 = rf(ctx, market) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MarketMapHooks_AfterMarketRemoved_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AfterMarketRemoved' +type MarketMapHooks_AfterMarketRemoved_Call struct { + *mock.Call +} + +// AfterMarketRemoved is a helper method to define mock.On call +// - ctx types.Context +// - market marketmaptypes.Market +func (_e *MarketMapHooks_Expecter) AfterMarketRemoved(ctx interface{}, market interface{}) *MarketMapHooks_AfterMarketRemoved_Call { + return &MarketMapHooks_AfterMarketRemoved_Call{Call: _e.mock.On("AfterMarketRemoved", ctx, market)} +} + +func (_c *MarketMapHooks_AfterMarketRemoved_Call) Run(run func(ctx types.Context, market marketmaptypes.Market)) *MarketMapHooks_AfterMarketRemoved_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(marketmaptypes.Market)) + }) + return _c +} + +func (_c *MarketMapHooks_AfterMarketRemoved_Call) Return(_a0 error) *MarketMapHooks_AfterMarketRemoved_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MarketMapHooks_AfterMarketRemoved_Call) RunAndReturn(run func(types.Context, marketmaptypes.Market) error) *MarketMapHooks_AfterMarketRemoved_Call { + _c.Call.Return(run) + return _c +} + // AfterMarketUpdated provides a mock function with given fields: ctx, market func (_m *MarketMapHooks) AfterMarketUpdated(ctx types.Context, market marketmaptypes.Market) error { ret := _m.Called(ctx, market) From a749d366f9b951c1a9dc8751c34ad2b39915e552 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 15:57:44 -0400 Subject: [PATCH 11/35] hooks --- x/oracle/keeper/hooks.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x/oracle/keeper/hooks.go b/x/oracle/keeper/hooks.go index 64abcee26..8a4e5e180 100644 --- a/x/oracle/keeper/hooks.go +++ b/x/oracle/keeper/hooks.go @@ -45,3 +45,10 @@ func (h Hooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]marketmapt return nil } + +// AfterMarketRemoved is the marketmap hook for x/oracle that is run after a market is removed in +// the marketmap. +func (h Hooks) AfterMarketRemoved(_ sdk.Context, _ marketmaptypes.Market) error { + // TODO + return nil +} From d00d7e3f683a064af84032b3d1f3a17056f0f96c Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 16:46:42 -0400 Subject: [PATCH 12/35] testingtown --- x/marketmap/keeper/msg_server_test.go | 94 +++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index d9df59bad..55e9a4290 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -537,4 +537,98 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Require().Error(err) s.Require().Nil(resp) }) + + s.Run("unable to remove non-existent market - multiple", func() { + msg := &types.MsgRemoveMarkets{ + Authority: s.marketAuthorities[0], + Markets: []string{"BTC/USD", "ETH/USDT"}, + } + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("unable to remove non-existent market - single", func() { + msg := &types.MsgRemoveMarkets{ + Authority: s.marketAuthorities[0], + Markets: []string{"BTC/USD"}, + } + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("able to remove disabled market", func() { + copyBTC := btcusdt + copyBTC.Ticker.Enabled = false + + msg := &types.MsgRemoveMarkets{ + Authority: s.marketAuthorities[0], + Markets: []string{copyBTC.Ticker.String()}, + } + + msgCreate := &types.MsgCreateMarkets{ + Authority: s.marketAuthorities[0], + CreateMarkets: []types.Market{copyBTC}, + } + + _, err := msgServer.CreateMarkets(s.ctx, msgCreate) + s.Require().NoError(err) + + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) + s.Require().Error(err) + }) + + s.Run("unable to remove enabled market", func() { + copyBTC := btcusdt + copyBTC.Ticker.Enabled = true + + msg := &types.MsgRemoveMarkets{ + Authority: s.marketAuthorities[0], + Markets: []string{copyBTC.Ticker.String()}, + } + + msgCreate := &types.MsgCreateMarkets{ + Authority: s.marketAuthorities[0], + CreateMarkets: []types.Market{copyBTC}, + } + + _, err := msgServer.CreateMarkets(s.ctx, msgCreate) + s.Require().NoError(err) + + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + + // market should exist + _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) + s.Require().NoError(err) + + // update market to be disabled + copyBTC.Ticker.Enabled = false + + msgUpdate := &types.MsgUpdateMarkets{ + Authority: s.marketAuthorities[0], + UpdateMarkets: []types.Market{copyBTC}, + } + + _, err = msgServer.UpdateMarkets(s.ctx, msgUpdate) + s.Require().NoError(err) + + // remove + resp, err = msgServer.RemoveMarkets(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) + s.Require().Error(err) + }) + + // TODO: more testing } From a69fe1961898eb178034aaf415c5405a2ad4b733 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 20 Sep 2024 16:50:30 -0400 Subject: [PATCH 13/35] update --- x/marketmap/keeper/msg_server_test.go | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index 55e9a4290..521be566b 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -567,12 +567,7 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { Markets: []string{copyBTC.Ticker.String()}, } - msgCreate := &types.MsgCreateMarkets{ - Authority: s.marketAuthorities[0], - CreateMarkets: []types.Market{copyBTC}, - } - - _, err := msgServer.CreateMarkets(s.ctx, msgCreate) + err := s.keeper.CreateMarket(s.ctx, copyBTC) s.Require().NoError(err) resp, err := msgServer.RemoveMarkets(s.ctx, msg) @@ -593,12 +588,7 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { Markets: []string{copyBTC.Ticker.String()}, } - msgCreate := &types.MsgCreateMarkets{ - Authority: s.marketAuthorities[0], - CreateMarkets: []types.Market{copyBTC}, - } - - _, err := msgServer.CreateMarkets(s.ctx, msgCreate) + err := s.keeper.CreateMarket(s.ctx, copyBTC) s.Require().NoError(err) resp, err := msgServer.RemoveMarkets(s.ctx, msg) @@ -612,12 +602,7 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { // update market to be disabled copyBTC.Ticker.Enabled = false - msgUpdate := &types.MsgUpdateMarkets{ - Authority: s.marketAuthorities[0], - UpdateMarkets: []types.Market{copyBTC}, - } - - _, err = msgServer.UpdateMarkets(s.ctx, msgUpdate) + err = s.keeper.UpdateMarket(s.ctx, copyBTC) s.Require().NoError(err) // remove From bfcd9b8c16c34e92264ea1afd396fa4f68d4b09a Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 23 Sep 2024 11:19:45 -0400 Subject: [PATCH 14/35] todos --- x/marketmap/keeper/msg_server_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index 521be566b..a616d51e4 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -616,4 +616,8 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { }) // TODO: more testing + // - resulting state is invalid + // - multi market message + // - fail if one is invalid + // - pass if one is valid } From 4ab6bfefb1d99ef3fbe43e5d1248465ffee9344c Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 23 Sep 2024 11:25:57 -0400 Subject: [PATCH 15/35] admin --- proto/connect/marketmap/v2/tx.proto | 8 +- x/marketmap/keeper/msg_server.go | 10 ++- x/marketmap/types/tx.pb.go | 118 ++++++++++++++-------------- 3 files changed, 70 insertions(+), 66 deletions(-) diff --git a/proto/connect/marketmap/v2/tx.proto b/proto/connect/marketmap/v2/tx.proto index 886ef9694..5cbc5e1fb 100644 --- a/proto/connect/marketmap/v2/tx.proto +++ b/proto/connect/marketmap/v2/tx.proto @@ -143,11 +143,11 @@ message MsgRemoveMarketAuthoritiesResponse {} // MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the // new markets to be removed from the market map. message MsgRemoveMarkets { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "admin"; - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Admin defines the authority that is the x/marketmap + // Admin account. This account is set in the module parameters. + string admin = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Markets is the list of markets to remove. repeated string markets = 2; diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 4c9c49a6d..0f1cb92b2 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -260,9 +260,13 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar ctx := sdk.UnwrapSDKContext(goCtx) - // perform basic msg validity checks - if err := ms.verifyMarketAuthorities(ctx, msg); err != nil { - return nil, fmt.Errorf("unable to verify market authorities: %w", err) + params, err := ms.k.GetParams(ctx) + if err != nil { + return nil, err + } + + if msg.Authority != params.Admin { + return nil, fmt.Errorf("request admin %s does not match module admin %s", msg.Admin, params.Admin) } for _, market := range msg.Markets { diff --git a/x/marketmap/types/tx.pb.go b/x/marketmap/types/tx.pb.go index 6dee61f30..166f82441 100644 --- a/x/marketmap/types/tx.pb.go +++ b/x/marketmap/types/tx.pb.go @@ -519,9 +519,9 @@ var xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse proto.InternalMessageInfo // MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the // new markets to be removed from the market map. type MsgRemoveMarkets struct { - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // Admin defines the authority that is the x/marketmap + // Admin account. This account is set in the module parameters. + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` // Markets is the list of markets to remove. Markets []string `protobuf:"bytes,2,rep,name=markets,proto3" json:"markets,omitempty"` } @@ -559,9 +559,9 @@ func (m *MsgRemoveMarkets) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveMarkets proto.InternalMessageInfo -func (m *MsgRemoveMarkets) GetAuthority() string { +func (m *MsgRemoveMarkets) GetAdmin() string { if m != nil { - return m.Authority + return m.Admin } return "" } @@ -630,53 +630,53 @@ func init() { func init() { proto.RegisterFile("connect/marketmap/v2/tx.proto", fileDescriptor_37df9476ca9a2f81) } var fileDescriptor_37df9476ca9a2f81 = []byte{ - // 725 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, - 0x14, 0xef, 0x14, 0x8a, 0xf6, 0x69, 0x11, 0xd6, 0x26, 0xac, 0x1b, 0x6d, 0x71, 0x43, 0x2a, 0x92, - 0xb0, 0x8b, 0x35, 0x31, 0xa4, 0x7a, 0xb0, 0x35, 0x1e, 0x34, 0x69, 0x62, 0xd6, 0x90, 0x18, 0x2f, - 0xcd, 0xd2, 0x4e, 0x96, 0x0d, 0xec, 0x9f, 0xec, 0x4c, 0x37, 0x70, 0x33, 0x1a, 0x2f, 0x5e, 0x34, - 0x9e, 0x3c, 0xea, 0x37, 0xe0, 0xe0, 0x57, 0x30, 0xe1, 0x48, 0x38, 0x79, 0x32, 0x06, 0x0e, 0xf8, - 0x31, 0x4c, 0x77, 0x66, 0x97, 0x0e, 0x74, 0x4b, 0x8b, 0x5e, 0x60, 0xf6, 0xbd, 0xdf, 0x7b, 0xef, - 0xf7, 0xfe, 0xcc, 0x9b, 0xc2, 0xad, 0xb6, 0xe7, 0xba, 0xb8, 0x4d, 0x75, 0xc7, 0x0c, 0x36, 0x31, - 0x75, 0x4c, 0x5f, 0x0f, 0xab, 0x3a, 0xdd, 0xd6, 0xfc, 0xc0, 0xa3, 0x9e, 0x54, 0xe4, 0x6a, 0x2d, - 0x51, 0x6b, 0x61, 0x55, 0x99, 0x6b, 0x7b, 0xc4, 0xf1, 0x88, 0xee, 0x10, 0x4b, 0x0f, 0xef, 0xf5, - 0xfe, 0x31, 0xb8, 0x52, 0xb4, 0x3c, 0xcb, 0x8b, 0x8e, 0x7a, 0xef, 0xc4, 0xa5, 0x37, 0x18, 0xbc, - 0xc5, 0x14, 0xec, 0x83, 0xab, 0x66, 0x4d, 0xc7, 0x76, 0x3d, 0x3d, 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0xed, - 0x6d, 0x23, 0x09, 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6b, 0x13, 0x4f, + 0x14, 0xcf, 0xa4, 0x4d, 0xbf, 0xdf, 0x8c, 0xa6, 0xb6, 0x63, 0xa0, 0xeb, 0xa2, 0x49, 0x5d, 0x4a, + 0xac, 0x85, 0xee, 0xd6, 0x08, 0x52, 0xa2, 0x07, 0x13, 0xf1, 0xa0, 0x10, 0x90, 0x95, 0x82, 0x78, + 0x09, 0xdb, 0x64, 0xd8, 0x2e, 0xed, 0xfe, 0x60, 0x67, 0xb2, 0xb4, 0x37, 0x51, 0xbc, 0x78, 0x51, + 0x3c, 0x79, 0xd4, 0xff, 0xa0, 0x07, 0xff, 0x05, 0xa1, 0xc7, 0xd2, 0x93, 0x27, 0x91, 0xf6, 0x50, + 0xff, 0x0c, 0xc9, 0xce, 0xec, 0x66, 0xa7, 0xcd, 0xa6, 0x1b, 0xf5, 0xd2, 0xce, 0xbe, 0xf7, 0x79, + 0xef, 0x7d, 0xde, 0x8f, 0x79, 0x13, 0x78, 0xa3, 0xeb, 0x3a, 0x0e, 0xee, 0x52, 0xcd, 0x36, 0xfc, + 0x6d, 0x4c, 0x6d, 0xc3, 0xd3, 0x82, 0xba, 0x46, 0x77, 0x55, 0xcf, 0x77, 0xa9, 0x8b, 0xca, 0x5c, + 0xad, 0xc6, 0x6a, 0x35, 0xa8, 0xcb, 0x0b, 0x5d, 0x97, 0xd8, 0x2e, 0xd1, 0x6c, 0x62, 0x6a, 0xc1, + 0x9d, 0xc1, 0x3f, 0x06, 0x97, 0xcb, 0xa6, 0x6b, 0xba, 0xe1, 0x51, 0x1b, 0x9c, 0xb8, 0xf4, 0x1a, + 0x83, 0x77, 0x98, 0x82, 0x7d, 0x70, 0xd5, 0xbc, 0x61, 0x5b, 0x8e, 0xab, 0x85, 0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x18, 0x3b, 0x7d, 0x2c, 0xe5, 0x17, 0xc1, 0xf2, 0xff, 0x3a, 0xfb, 0x68, 0xe4, 0xd7, + 0x41, 0x63, 0xfa, 0xd3, 0x97, 0x2a, 0x50, 0x8e, 0x58, 0x6b, 0x1e, 0xf9, 0xd8, 0xa0, 0xf8, 0x6f, + 0x5b, 0xf3, 0x04, 0xce, 0x76, 0x43, 0x47, 0x9d, 0xc9, 0x3b, 0x54, 0xea, 0x26, 0x29, 0x4c, 0xda, + 0x27, 0x81, 0xbf, 0x22, 0x87, 0x6d, 0x12, 0x64, 0x51, 0x79, 0xa3, 0x84, 0x59, 0xd9, 0xfe, 0x41, + 0xc2, 0xac, 0xd9, 0x7f, 0x92, 0x70, 0x3f, 0x49, 0x61, 0xf2, 0xc1, 0xec, 0x9d, 0x4b, 0x58, 0x90, + 0xc5, 0x09, 0xbf, 0x07, 0xb0, 0xd8, 0x26, 0xe6, 0xb3, 0xf0, 0x42, 0xa2, 0x06, 0x9c, 0x61, 0x57, + 0x33, 0x4c, 0x33, 0x95, 0x29, 0x43, 0x73, 0xa6, 0xdc, 0x42, 0xac, 0x52, 0x3e, 0x73, 0x95, 0x1a, + 0xb3, 0x62, 0x5a, 0xca, 0x55, 0x38, 0x1f, 0x13, 0x8a, 0x69, 0xbe, 0x01, 0x50, 0x6e, 0x13, 0x53, + 0xc7, 0xb6, 0x1b, 0xf0, 0x1c, 0x9a, 0xdc, 0xc2, 0xc2, 0x04, 0xdd, 0x86, 0x73, 0x7e, 0xa8, 0xea, + 0x18, 0x2c, 0x0c, 0xbf, 0x5f, 0x45, 0xfd, 0x0a, 0x93, 0x37, 0x23, 0x31, 0x52, 0x61, 0xc1, 0xe8, + 0xd9, 0x96, 0x73, 0x21, 0x45, 0x06, 0x6b, 0xc0, 0x01, 0x3d, 0x76, 0x56, 0x96, 0xa0, 0x92, 0x4e, + 0x22, 0xe6, 0xba, 0x15, 0x8e, 0x50, 0x12, 0x95, 0x88, 0x0a, 0x32, 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75, 0xad, 0x0c, 0x3c, 0x17, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1346,10 +1346,10 @@ func (m *MsgRemoveMarkets) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) i-- dAtA[i] = 0xa } @@ -1540,7 +1540,7 @@ func (m *MsgRemoveMarkets) Size() (n int) { } var l int _ = l - l = len(m.Authority) + l = len(m.Admin) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2541,7 +2541,7 @@ func (m *MsgRemoveMarkets) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2569,7 +2569,7 @@ func (m *MsgRemoveMarkets) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { From 5b07a7909fbd990a15446ea39d9353da3156ccf2 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 23 Sep 2024 11:32:31 -0400 Subject: [PATCH 16/35] admin fix --- x/marketmap/keeper/msg_server.go | 2 +- x/marketmap/keeper/msg_server_test.go | 18 +++++++++--------- x/marketmap/types/msg.go | 2 +- x/marketmap/types/msg_test.go | 18 +++++++++--------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 0f1cb92b2..313957669 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -265,7 +265,7 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar return nil, err } - if msg.Authority != params.Admin { + if msg.Admin != params.Admin { return nil, fmt.Errorf("request admin %s does not match module admin %s", msg.Admin, params.Admin) } diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index a616d51e4..3f6879639 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -531,7 +531,7 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Run("unable to process for invalid authority", func() { msg := &types.MsgRemoveMarkets{ - Authority: "invalid", + Admin: "invalid", } resp, err := msgServer.RemoveMarkets(s.ctx, msg) s.Require().Error(err) @@ -540,8 +540,8 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Run("unable to remove non-existent market - multiple", func() { msg := &types.MsgRemoveMarkets{ - Authority: s.marketAuthorities[0], - Markets: []string{"BTC/USD", "ETH/USDT"}, + Admin: s.admin, + Markets: []string{"BTC/USD", "ETH/USDT"}, } resp, err := msgServer.RemoveMarkets(s.ctx, msg) s.Require().Error(err) @@ -550,8 +550,8 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Run("unable to remove non-existent market - single", func() { msg := &types.MsgRemoveMarkets{ - Authority: s.marketAuthorities[0], - Markets: []string{"BTC/USD"}, + Admin: s.admin, + Markets: []string{"BTC/USD"}, } resp, err := msgServer.RemoveMarkets(s.ctx, msg) s.Require().Error(err) @@ -563,8 +563,8 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { copyBTC.Ticker.Enabled = false msg := &types.MsgRemoveMarkets{ - Authority: s.marketAuthorities[0], - Markets: []string{copyBTC.Ticker.String()}, + Admin: s.admin, + Markets: []string{copyBTC.Ticker.String()}, } err := s.keeper.CreateMarket(s.ctx, copyBTC) @@ -584,8 +584,8 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { copyBTC.Ticker.Enabled = true msg := &types.MsgRemoveMarkets{ - Authority: s.marketAuthorities[0], - Markets: []string{copyBTC.Ticker.String()}, + Admin: s.admin, + Markets: []string{copyBTC.Ticker.String()}, } err := s.keeper.CreateMarket(s.ctx, copyBTC) diff --git a/x/marketmap/types/msg.go b/x/marketmap/types/msg.go index c36d137f8..2a4eb50bb 100644 --- a/x/marketmap/types/msg.go +++ b/x/marketmap/types/msg.go @@ -132,7 +132,7 @@ func (m *MsgRemoveMarketAuthorities) ValidateBasic() error { // whether the signer is a valid acc-address. func (m *MsgRemoveMarkets) ValidateBasic() error { // validate signer address - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + if _, err := sdk.AccAddressFromBech32(m.Admin); err != nil { return err } diff --git a/x/marketmap/types/msg_test.go b/x/marketmap/types/msg_test.go index 1652f025c..511c489d5 100644 --- a/x/marketmap/types/msg_test.go +++ b/x/marketmap/types/msg_test.go @@ -528,39 +528,39 @@ func TestValidateBasicMsgRemoveMarkets(t *testing.T) { { "if the Authority is not an acc-address - fail", types.MsgRemoveMarkets{ - Authority: "invalid", + Admin: "invalid", }, false, }, { name: "invalid message (no markets) - fail", msg: types.MsgRemoveMarkets{ - Markets: nil, - Authority: sample.Address(rng), + Markets: nil, + Admin: sample.Address(rng), }, expectPass: false, }, { name: "valid message - single market", msg: types.MsgRemoveMarkets{ - Markets: []string{"USDT/USD"}, - Authority: sample.Address(rng), + Markets: []string{"USDT/USD"}, + Admin: sample.Address(rng), }, expectPass: true, }, { name: "valid message - multiple markets", msg: types.MsgRemoveMarkets{ - Markets: []string{"USDT/USD", "ETH/USD"}, - Authority: sample.Address(rng), + Markets: []string{"USDT/USD", "ETH/USD"}, + Admin: sample.Address(rng), }, expectPass: true, }, { name: "invalid message (duplicate markets", msg: types.MsgRemoveMarkets{ - Markets: []string{"USDT/USD", "USDT/USD"}, - Authority: sample.Address(rng), + Markets: []string{"USDT/USD", "USDT/USD"}, + Admin: sample.Address(rng), }, expectPass: false, }, From 713c7eb9edae641b500e2cebe4ce77161dd0c4ae Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 23 Sep 2024 11:47:49 -0400 Subject: [PATCH 17/35] test --- x/marketmap/keeper/msg_server_test.go | 125 ++++++++++++++++++++++++-- 1 file changed, 117 insertions(+), 8 deletions(-) diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index 3f6879639..f44e55be0 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -583,14 +583,14 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { copyBTC := btcusdt copyBTC.Ticker.Enabled = true + err := s.keeper.CreateMarket(s.ctx, copyBTC) + s.Require().NoError(err) + msg := &types.MsgRemoveMarkets{ Admin: s.admin, Markets: []string{copyBTC.Ticker.String()}, } - err := s.keeper.CreateMarket(s.ctx, copyBTC) - s.Require().NoError(err) - resp, err := msgServer.RemoveMarkets(s.ctx, msg) s.Require().Error(err) s.Require().Nil(resp) @@ -615,9 +615,118 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Require().Error(err) }) - // TODO: more testing - // - resulting state is invalid - // - multi market message - // - fail if one is invalid - // - pass if one is valid + s.Run("resulting state is invalid - 1", func() { + // add a market that depends on the btc market + copyBTC := btcusdt + + err := s.keeper.CreateMarket(s.ctx, copyBTC) + s.Require().NoError(err) + + copyETH := ethusdt + copyETH.ProviderConfigs = []types.ProviderConfig{ + { + Name: "normalized", + OffChainTicker: "normalized", + NormalizeByPair: &connecttypes.CurrencyPair{ + Base: copyBTC.Ticker.CurrencyPair.Base, + Quote: copyBTC.Ticker.CurrencyPair.Quote, + }, + }, + } + + err = s.keeper.CreateMarket(s.ctx, copyETH) + s.Require().NoError(err) + + msgRemoveBTC := &types.MsgRemoveMarkets{ + Admin: s.admin, + Markets: []string{copyBTC.Ticker.String()}, + } + + msgRemoveETH := &types.MsgRemoveMarkets{ + Admin: s.admin, + Markets: []string{copyETH.Ticker.String()}, + } + + resp, err := msgServer.RemoveMarkets(s.ctx, msgRemoveBTC) + s.Require().Error(err) + s.Require().Nil(resp) + + // remove dependent market first for valid state in 2 transaction + resp, err = msgServer.RemoveMarkets(s.ctx, msgRemoveETH) + s.Require().NoError(err) + s.Require().NotNil(resp) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyETH.Ticker.String()) + s.Require().Error(err) + }) + + s.Run("remove both markets in one tx - no dependency", func() { + // add a market that depends on the btc market + copyBTC := btcusdt + copyETH := ethusdt + + err := s.keeper.CreateMarket(s.ctx, copyBTC) + s.Require().NoError(err) + + err = s.keeper.CreateMarket(s.ctx, copyETH) + s.Require().NoError(err) + + msg := &types.MsgRemoveMarkets{ + Admin: s.admin, + Markets: []string{copyBTC.Ticker.String(), copyETH.Ticker.String()}, + } + + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) + s.Require().Error(err) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyETH.Ticker.String()) + s.Require().Error(err) + }) + + s.Run("remove both markets in one tx - with dependency", func() { + // add a market that depends on the btc market + copyBTC := btcusdt + + err := s.keeper.CreateMarket(s.ctx, copyBTC) + s.Require().NoError(err) + + copyETH := ethusdt + copyETH.ProviderConfigs = []types.ProviderConfig{ + { + Name: "normalized", + OffChainTicker: "normalized", + NormalizeByPair: &connecttypes.CurrencyPair{ + Base: copyBTC.Ticker.CurrencyPair.Base, + Quote: copyBTC.Ticker.CurrencyPair.Quote, + }, + }, + } + + err = s.keeper.CreateMarket(s.ctx, copyETH) + s.Require().NoError(err) + + msg := &types.MsgRemoveMarkets{ + Admin: s.admin, + Markets: []string{copyBTC.Ticker.String(), copyETH.Ticker.String()}, + } + + resp, err := msgServer.RemoveMarkets(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) + s.Require().Error(err) + + // market should not exist + _, err = s.keeper.GetMarket(s.ctx, copyETH.Ticker.String()) + s.Require().Error(err) + }) } From 4cfbb958c985d0d3a2eb7a07136199d15f989e24 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 23 Sep 2024 14:51:00 -0400 Subject: [PATCH 18/35] clean --- tests/integration/connect_ccv_suite.go | 2 +- tests/integration/connect_setup.go | 19 ++--- tests/integration/connect_suite.go | 79 +++++++++++++++----- tests/integration/connect_validator_suite.go | 11 +-- tests/integration/consumer.go | 2 +- x/marketmap/types/codec.go | 1 - 6 files changed, 76 insertions(+), 38 deletions(-) diff --git a/tests/integration/connect_ccv_suite.go b/tests/integration/connect_ccv_suite.go index 514ca95f9..d70aa029d 100644 --- a/tests/integration/connect_ccv_suite.go +++ b/tests/integration/connect_ccv_suite.go @@ -44,7 +44,7 @@ func NewConnectCCVIntegrationSuite( func (s *ConnectCCVSuite) TestCCVAggregation() { ethusdc := connecttypes.NewCurrencyPair("ETH", "USDC") - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 3600, ethusdc)) + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 3600, enabledTicker(ethusdc))) cc, closeFn, err := GetChainGRPC(s.chain) s.Require().NoError(err) diff --git a/tests/integration/connect_setup.go b/tests/integration/connect_setup.go index 140e4e011..385f6dd9a 100644 --- a/tests/integration/connect_setup.go +++ b/tests/integration/connect_setup.go @@ -359,21 +359,16 @@ func PassProposal(chain *cosmos.CosmosChain, propId string, timeout time.Duratio // AddCurrencyPairs creates + submits the proposal to add the given currency-pairs to state, votes for the prop w/ all nodes, // and waits for the proposal to pass. -func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, user cosmos.User, price float64, cps ...connecttypes.CurrencyPair) error { - creates := make([]mmtypes.Market, len(cps)) - for i, cp := range cps { +func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, user cosmos.User, price float64, + tickers ...mmtypes.Ticker) error { + creates := make([]mmtypes.Market, len(tickers)) + for i, ticker := range tickers { creates[i] = mmtypes.Market{ - Ticker: mmtypes.Ticker{ - CurrencyPair: cp, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: "", - Enabled: true, - }, + Ticker: ticker, ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: cp.String(), + OffChainTicker: ticker.String(), Metadata_JSON: fmt.Sprintf(`{"price": %f}`, price), }, }, @@ -451,7 +446,7 @@ func QueryProposal(chain *cosmos.CosmosChain, propID string) (*govtypesv1.QueryP }) } -// WaitForProposalStatus, waits for the deposit period for the proposal to end +// WaitForProposalStatus waits for the deposit period for the proposal to end func WaitForProposalStatus(chain *cosmos.CosmosChain, propID string, timeout time.Duration, status govtypesv1.ProposalStatus) error { return testutil.WaitForCondition(timeout, 1*time.Second, func() (bool, error) { prop, err := QueryProposal(chain, propID) diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index f71f20db3..01b6479db 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -38,7 +38,6 @@ const ( defaultDenom = "stake" validatorKey = "validator" yes = "yes" - deposit = 1000000 userMnemonic = "foster poverty abstract scorpion short shrimp tilt edge romance adapt only benefit moral another where host egg echo ability wisdom lizard lazy pool roast" userAccountAddressHex = "877E307618AB73E009A978AC32E0264791F6D40A" gasPrice = 100 @@ -347,10 +346,16 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { // pass a governance proposal to approve a new currency-pair, and check Prices are reported s.Run("Add a currency-pair and check Prices", func() { - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []connecttypes.CurrencyPair{ + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []mmtypes.Ticker{ { - Base: "BTC", - Quote: "USD", + CurrencyPair: connecttypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", + }, + Decimals: 8, + MinProviderCount: 1, + Enabled: true, + Metadata_JSON: "", }, }...)) @@ -365,14 +370,24 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { s.Run("Add multiple Currency Pairs", func() { cp1 := connecttypes.NewCurrencyPair("ETH", "USD") cp2 := connecttypes.NewCurrencyPair("USDT", "USD") - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []connecttypes.CurrencyPair{ - cp1, cp2, + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []mmtypes.Ticker{ + enabledTicker(cp1), + enabledTicker(cp2), }...)) resp, err := QueryCurrencyPairs(s.chain) s.Require().NoError(err) s.Require().True(len(resp.CurrencyPairs) == 3) }) + + s.Run("remove a currency pair", func() { + disabledCP := connecttypes.NewCurrencyPair("DIS", "ABLE") + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []mmtypes.Ticker{ + disabledTicker(disabledCP), + }...)) + + }) + } func translateGRPCAddr(chain *cosmos.CosmosChain) string { @@ -381,9 +396,16 @@ func translateGRPCAddr(chain *cosmos.CosmosChain) string { func (s *ConnectOracleIntegrationSuite) TestNodeFailures() { ethusdcCP := connecttypes.NewCurrencyPair("ETH", "USDC") + tickerETHUSDC := mmtypes.Ticker{ + CurrencyPair: ethusdcCP, + Decimals: 8, + MinProviderCount: 1, + Enabled: true, + Metadata_JSON: "", + } - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []connecttypes.CurrencyPair{ - ethusdcCP, + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []mmtypes.Ticker{ + tickerETHUSDC, }...)) cc, closeFn, err := GetChainGRPC(s.chain) @@ -577,19 +599,39 @@ func (s *ConnectOracleIntegrationSuite) TestNodeFailures() { }) } +func enabledTicker(pair connecttypes.CurrencyPair) mmtypes.Ticker { + return mmtypes.Ticker{ + CurrencyPair: pair, + Decimals: 8, + MinProviderCount: 1, + Enabled: true, + Metadata_JSON: "", + } +} + +func disabledTicker(pair connecttypes.CurrencyPair) mmtypes.Ticker { + return mmtypes.Ticker{ + CurrencyPair: pair, + Decimals: 8, + MinProviderCount: 1, + Enabled: false, + Metadata_JSON: "", + } +} + func (s *ConnectOracleIntegrationSuite) TestMultiplePriceFeeds() { ethusdcCP := connecttypes.NewCurrencyPair("ETH", "USDC") ethusdtCP := connecttypes.NewCurrencyPair("ETH", "USDT") ethusdCP := connecttypes.NewCurrencyPair("ETH", "USD") - // add multiple currency pairs - cps := []connecttypes.CurrencyPair{ - ethusdcCP, - ethusdtCP, - ethusdCP, + // add multiple tickers + tickers := []mmtypes.Ticker{ + enabledTicker(ethusdcCP), + enabledTicker(ethusdtCP), + enabledTicker(ethusdCP), } - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, cps...)) + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, tickers...)) cc, closeFn, err := GetChainGRPC(s.chain) s.Require().NoError(err) @@ -671,8 +713,8 @@ func (s *ConnectOracleIntegrationSuite) TestMultiplePriceFeeds() { s.Require().NoError(err) // query for the given currency pair - for _, cp := range cps { - resp, _, err := QueryCurrencyPair(s.chain, cp, height) + for _, ticker := range tickers { + resp, _, err := QueryCurrencyPair(s.chain, ticker.CurrencyPair, height) s.Require().NoError(err) s.Require().Equal(int64(110000000), resp.Price.Int64()) } @@ -739,12 +781,13 @@ func (s *ConnectOracleIntegrationSuite) TestMultiplePriceFeeds() { s.Require().NoError(err) // query for the given currency pair - for _, cp := range cps { - resp, _, err := QueryCurrencyPair(s.chain, cp, height) + for _, ticker := range tickers { + resp, _, err := QueryCurrencyPair(s.chain, ticker.CurrencyPair, height) s.Require().NoError(err) s.Require().Equal(int64(110000000), resp.Price.Int64()) } }) + } func getIDForCurrencyPair(ctx context.Context, client oracletypes.QueryClient, cp connecttypes.CurrencyPair) (uint64, error) { diff --git a/tests/integration/connect_validator_suite.go b/tests/integration/connect_validator_suite.go index e56ff4fb1..ee70a9401 100644 --- a/tests/integration/connect_validator_suite.go +++ b/tests/integration/connect_validator_suite.go @@ -2,6 +2,7 @@ package integration import ( "context" + mmtypes "github.com/skip-mev/connect/v2/x/marketmap/types" "time" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -30,13 +31,13 @@ func (s *ConnectOracleValidatorIntegrationSuite) TestUnbonding() { ethusdCP := connecttypes.NewCurrencyPair("ETH", "USD") // add multiple currency pairs - cps := []connecttypes.CurrencyPair{ - ethusdcCP, - ethusdtCP, - ethusdCP, + tickers := []mmtypes.Ticker{ + enabledTicker(ethusdcCP), + enabledTicker(ethusdtCP), + enabledTicker(ethusdCP), } - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, cps...)) + s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, tickers...)) cc, closeFn, err := GetChainGRPC(s.chain) s.Require().NoError(err) diff --git a/tests/integration/consumer.go b/tests/integration/consumer.go index 42e3889c7..5c9b12130 100644 --- a/tests/integration/consumer.go +++ b/tests/integration/consumer.go @@ -16,7 +16,7 @@ import ( var ( providerChainID = "provider-1" - providerNumValidators = int(4) + providerNumValidators = 4 providerVersion = "v5.0.0-rc0" ) diff --git a/x/marketmap/types/codec.go b/x/marketmap/types/codec.go index eb12e3b17..6fbb6fcdd 100644 --- a/x/marketmap/types/codec.go +++ b/x/marketmap/types/codec.go @@ -17,7 +17,6 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgParams{}, "connect/x/marketmap/MsgParams") legacy.RegisterAminoMsg(cdc, &MsgUpsertMarkets{}, "connect/x/marketmap/MsgUpsertMarkets") legacy.RegisterAminoMsg(cdc, &MsgRemoveMarkets{}, "connect/x/marketmap/MsgRemoveMarkets") - legacy.RegisterAminoMsg(cdc, &MsgRemoveMarketAuthorities{}, "connect/x/marketmap/MsgRemoveMarketAuthorities") } // RegisterInterfaces registers the x/marketmap messages + message service w/ the InterfaceRegistry (registry). From 68414d83ef0a3908b67a51809ea880d05472b531 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 23 Sep 2024 17:42:52 -0400 Subject: [PATCH 19/35] test --- tests/integration/connect_setup.go | 62 ++++++++++++++++++++++++++++-- tests/integration/connect_suite.go | 9 +++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/tests/integration/connect_setup.go b/tests/integration/connect_setup.go index 385f6dd9a..99f1ee0df 100644 --- a/tests/integration/connect_setup.go +++ b/tests/integration/connect_setup.go @@ -305,6 +305,33 @@ func QueryCurrencyPair(chain *cosmos.CosmosChain, cp connecttypes.CurrencyPair, return res.Price, int64(res.Nonce), nil } +// QueryMarket queries a market from the market map. +func QueryMarket(chain *cosmos.CosmosChain, cp connecttypes.CurrencyPair) (mmtypes.Market, error) { + grpcAddr := chain.GetHostGRPCAddress() + + // create the client + cc, err := grpc.Dial(grpcAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + return mmtypes.Market{}, err + } + defer cc.Close() + + // create the mm client + client := mmtypes.NewQueryClient(cc) + + ctx := context.Background() + + // query the currency pairs + res, err := client.Market(ctx, &mmtypes.MarketRequest{ + CurrencyPair: cp, + }) + if err != nil { + return mmtypes.Market{}, err + } + + return res.Market, nil +} + // SubmitProposal creates and submits a proposal to the chain func SubmitProposal(chain *cosmos.CosmosChain, deposit sdk.Coin, submitter string, msgs ...sdk.Msg) (string, error) { // build the proposal @@ -375,9 +402,9 @@ func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, us } } - msg := &mmtypes.MsgCreateMarkets{ - Authority: s.user.FormattedAddress(), - CreateMarkets: creates, + msg := &mmtypes.MsgUpsertMarkets{ + Authority: s.user.FormattedAddress(), + Markets: creates, } tx := CreateTx(s.T(), s.chain, user, gasPrice, msg) @@ -398,6 +425,35 @@ func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, us return nil } +func (s *ConnectIntegrationSuite) RemoveMarket(chain *cosmos.CosmosChain, user cosmos.User, + markets []connecttypes.CurrencyPair) error { + marketString := make([]string, len(markets)) + for i, market := range markets { + marketString[i] = market.String() + } + + msg := &mmtypes.MsgRemoveMarkets{ + Admin: s.user.FormattedAddress(), + Markets: marketString, + } + + tx := CreateTx(s.T(), s.chain, s.user, gasPrice, msg) + + // get an rpc endpoint for the chain + client := chain.Nodes()[0].Client + // broadcast the tx + resp, err := client.BroadcastTxCommit(context.Background(), tx) + if err != nil { + return err + } + + if resp.TxResult.Code != abcitypes.CodeTypeOK { + return fmt.Errorf(resp.TxResult.Log) + } + + return nil +} + func (s *ConnectIntegrationSuite) UpdateCurrencyPair(chain *cosmos.CosmosChain, markets []mmtypes.Market) error { msg := &mmtypes.MsgUpsertMarkets{ Authority: s.user.FormattedAddress(), diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index 01b6479db..4fd4a6640 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -386,6 +386,15 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { disabledTicker(disabledCP), }...)) + market, err := QueryMarket(s.chain, disabledCP) + s.Require().NoError(err) + s.Require().NotNil(market) + + s.Require().NoError(s.RemoveMarket(s.chain, s.user, []connecttypes.CurrencyPair{disabledCP})) + + // check removed + _, err = QueryMarket(s.chain, disabledCP) + s.Require().Error(err) }) } From 205f63dd756ae9ec67395385aff81aa8a3f16f1c Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 24 Sep 2024 12:05:20 -0400 Subject: [PATCH 20/35] clean --- tests/integration/connect_suite.go | 14 ++++---------- tests/integration/connect_validator_suite.go | 2 +- x/marketmap/keeper/keeper.go | 17 ++++++++++++++++- x/marketmap/keeper/keeper_test.go | 13 +++++++++++++ x/marketmap/types/errors.go | 2 +- x/oracle/keeper/hooks.go | 4 ++-- 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index 4fd4a6640..031554ff6 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -347,16 +347,10 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { // pass a governance proposal to approve a new currency-pair, and check Prices are reported s.Run("Add a currency-pair and check Prices", func() { s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []mmtypes.Ticker{ - { - CurrencyPair: connecttypes.CurrencyPair{ - Base: "BTC", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - Enabled: true, - Metadata_JSON: "", - }, + enabledTicker(connecttypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", + }), }...)) // check that the currency-pair is added to state diff --git a/tests/integration/connect_validator_suite.go b/tests/integration/connect_validator_suite.go index ee70a9401..77757a1af 100644 --- a/tests/integration/connect_validator_suite.go +++ b/tests/integration/connect_validator_suite.go @@ -2,7 +2,6 @@ package integration import ( "context" - mmtypes "github.com/skip-mev/connect/v2/x/marketmap/types" "time" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -11,6 +10,7 @@ import ( "github.com/skip-mev/connect/v2/oracle/types" connecttypes "github.com/skip-mev/connect/v2/pkg/types" "github.com/skip-mev/connect/v2/providers/static" + mmtypes "github.com/skip-mev/connect/v2/x/marketmap/types" oracletypes "github.com/skip-mev/connect/v2/x/oracle/types" ) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 5bd41fadb..043ba609f 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -156,7 +156,22 @@ func (k *Keeper) DeleteDisabledMarket(ctx context.Context, tickerStr string) err return err } if market.Ticker.Enabled { - return fmt.Errorf("cannot remove market: %w", types.NewMarketIsEnabled(types.TickerString(tickerStr))) + return fmt.Errorf("cannot remove market: %w", types.NewMarketIsEnabledError(types.TickerString(tickerStr))) + } + return k.markets.Remove(ctx, types.TickerString(tickerStr)) +} + +// DeleteMarket removes a Market. +// This is currently only expected to be called in upgrade handlers, and callers will need to separately call +// RemoveCurrencyPair on x/oracle to clean up leftover state in that module. +func (k *Keeper) DeleteMarket(ctx context.Context, tickerStr string) error { + // Check if Ticker exists + alreadyExists, err := k.markets.Has(ctx, types.TickerString(tickerStr)) + if err != nil { + return err + } + if !alreadyExists { + return types.NewMarketDoesNotExistsError(types.TickerString(tickerStr)) } return k.markets.Remove(ctx, types.TickerString(tickerStr)) } diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index b02527583..85dbf6c91 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -343,6 +343,19 @@ func (s *KeeperTestSuite) TestDeleteDisabledMarket() { s.Require().Error(err) } +func (s *KeeperTestSuite) TestDeleteMarket() { + // create a valid markets + s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) + + // invalid delete fails + s.Require().Error(s.keeper.DeleteMarket(s.ctx, "foobar")) + + // valid delete works + s.Require().NoError(s.keeper.DeleteMarket(s.ctx, btcusdt.Ticker.String())) + _, err := s.keeper.GetMarket(s.ctx, btcusdt.Ticker.String()) + s.Require().Error(err) +} + func (s *KeeperTestSuite) TestEnableDisableMarket() { // create a valid markets s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) diff --git a/x/marketmap/types/errors.go b/x/marketmap/types/errors.go index ddc208f77..a14f47e84 100644 --- a/x/marketmap/types/errors.go +++ b/x/marketmap/types/errors.go @@ -35,7 +35,7 @@ type MarketIsEnabledError struct { ticker TickerString } -func NewMarketIsEnabled(ticker TickerString) MarketIsEnabledError { +func NewMarketIsEnabledError(ticker TickerString) MarketIsEnabledError { return MarketIsEnabledError{ticker: ticker} } diff --git a/x/oracle/keeper/hooks.go b/x/oracle/keeper/hooks.go index 8a4e5e180..e13ed12de 100644 --- a/x/oracle/keeper/hooks.go +++ b/x/oracle/keeper/hooks.go @@ -48,7 +48,7 @@ func (h Hooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]marketmapt // AfterMarketRemoved is the marketmap hook for x/oracle that is run after a market is removed in // the marketmap. -func (h Hooks) AfterMarketRemoved(_ sdk.Context, _ marketmaptypes.Market) error { - // TODO +func (h Hooks) AfterMarketRemoved(ctx sdk.Context, market marketmaptypes.Market) error { + ctx.Logger().Info(fmt.Sprintf("market %s removed. retaining x/oracle state if it exists.", market.Ticker.String())) return nil } From 730d7744c7656f72e95e72b6098900039b92d822 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 24 Sep 2024 12:06:36 -0400 Subject: [PATCH 21/35] some logs --- x/oracle/keeper/hooks.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x/oracle/keeper/hooks.go b/x/oracle/keeper/hooks.go index e13ed12de..d228b425a 100644 --- a/x/oracle/keeper/hooks.go +++ b/x/oracle/keeper/hooks.go @@ -24,13 +24,14 @@ func (k *Keeper) Hooks() Hooks { // the marketmap. After the market is created, a currency pair and its state are initialized in the // oracle module. func (h Hooks) AfterMarketCreated(ctx sdk.Context, market marketmaptypes.Market) error { + ctx.Logger().Info(fmt.Sprintf("creating x/oracle state for market %s", market.Ticker.String())) return h.k.CreateCurrencyPair(ctx, market.Ticker.CurrencyPair) } // AfterMarketUpdated is the marketmap hook for x/oracle that is run after a market is updated in // the marketmap. -func (h Hooks) AfterMarketUpdated(_ sdk.Context, _ marketmaptypes.Market) error { - // TODO +func (h Hooks) AfterMarketUpdated(ctx sdk.Context, market marketmaptypes.Market) error { + ctx.Logger().Info(fmt.Sprintf("market %s updated", market.Ticker.String())) return nil } @@ -49,6 +50,6 @@ func (h Hooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]marketmapt // AfterMarketRemoved is the marketmap hook for x/oracle that is run after a market is removed in // the marketmap. func (h Hooks) AfterMarketRemoved(ctx sdk.Context, market marketmaptypes.Market) error { - ctx.Logger().Info(fmt.Sprintf("market %s removed. retaining x/oracle state if it exists.", market.Ticker.String())) + ctx.Logger().Info(fmt.Sprintf("market %s removed. retaining x/oracle state if it exists", market.Ticker.String())) return nil } From a6c710b10371298a4667eef023c8151ba2ef06e4 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 24 Sep 2024 12:10:16 -0400 Subject: [PATCH 22/35] keep enabled in integ --- tests/integration/connect_suite.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index 031554ff6..f9b86007a 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -372,9 +372,18 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { resp, err := QueryCurrencyPairs(s.chain) s.Require().NoError(err) s.Require().True(len(resp.CurrencyPairs) == 3) + + s.Run("fail to remove an enabled market", func() { + s.Require().Error(s.RemoveMarket(s.chain, s.user, []connecttypes.CurrencyPair{cp1})) + + // check not removed + market, err := QueryMarket(s.chain, cp1) + s.Require().NoError(err) + s.Require().NotNil(market) + }) }) - s.Run("remove a currency pair", func() { + s.Run("remove a disabled market", func() { disabledCP := connecttypes.NewCurrencyPair("DIS", "ABLE") s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, []mmtypes.Ticker{ disabledTicker(disabledCP), From 77d2b69af351c1b27342d6b7f7f37209c64e66a8 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Tue, 24 Sep 2024 12:10:49 -0400 Subject: [PATCH 23/35] format --- tests/integration/connect_setup.go | 6 ++++-- tests/integration/connect_suite.go | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/integration/connect_setup.go b/tests/integration/connect_setup.go index 99f1ee0df..225acb6cc 100644 --- a/tests/integration/connect_setup.go +++ b/tests/integration/connect_setup.go @@ -387,7 +387,8 @@ func PassProposal(chain *cosmos.CosmosChain, propId string, timeout time.Duratio // AddCurrencyPairs creates + submits the proposal to add the given currency-pairs to state, votes for the prop w/ all nodes, // and waits for the proposal to pass. func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, user cosmos.User, price float64, - tickers ...mmtypes.Ticker) error { + tickers ...mmtypes.Ticker, +) error { creates := make([]mmtypes.Market, len(tickers)) for i, ticker := range tickers { creates[i] = mmtypes.Market{ @@ -426,7 +427,8 @@ func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, us } func (s *ConnectIntegrationSuite) RemoveMarket(chain *cosmos.CosmosChain, user cosmos.User, - markets []connecttypes.CurrencyPair) error { + markets []connecttypes.CurrencyPair, +) error { marketString := make([]string, len(markets)) for i, market := range markets { marketString[i] = market.String() diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index f9b86007a..390e8e408 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -399,7 +399,6 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { _, err = QueryMarket(s.chain, disabledCP) s.Require().Error(err) }) - } func translateGRPCAddr(chain *cosmos.CosmosChain) string { @@ -799,7 +798,6 @@ func (s *ConnectOracleIntegrationSuite) TestMultiplePriceFeeds() { s.Require().Equal(int64(110000000), resp.Price.Int64()) } }) - } func getIDForCurrencyPair(ctx context.Context, client oracletypes.QueryClient, cp connecttypes.CurrencyPair) (uint64, error) { From a66e198a17a52386026537555cad12ecfb15ba0f Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Tue, 24 Sep 2024 14:54:29 -0400 Subject: [PATCH 24/35] Update x/marketmap/types/msg.go Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com> --- x/marketmap/types/msg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/marketmap/types/msg.go b/x/marketmap/types/msg.go index 2a4eb50bb..bb3621da6 100644 --- a/x/marketmap/types/msg.go +++ b/x/marketmap/types/msg.go @@ -143,7 +143,7 @@ func (m *MsgRemoveMarkets) ValidateBasic() error { seenMarkets := make(map[string]struct{}, len(m.Markets)) for _, market := range m.Markets { if _, seen := seenMarkets[market]; seen { - return fmt.Errorf("duplicate address %s found", market) + return fmt.Errorf("duplicate market %s found", market) } if _, err := connecttypes.CurrencyPairFromString(market); err != nil { From 918260f8b008e03aeae8a5f6592eb3122f5766cc Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 10:28:51 -0400 Subject: [PATCH 25/35] create simple delete wrapper that is idempotent --- x/marketmap/keeper/keeper.go | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 043ba609f..17b480643 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -148,31 +148,10 @@ func (k *Keeper) UpdateMarket(ctx context.Context, market types.Market) error { return k.setMarket(ctx, market) } -// DeleteDisabledMarket removes a Market if it is disabled. -func (k *Keeper) DeleteDisabledMarket(ctx context.Context, tickerStr string) error { - // Check if Ticker exists - market, err := k.markets.Get(ctx, types.TickerString(tickerStr)) - if err != nil { - return err - } - if market.Ticker.Enabled { - return fmt.Errorf("cannot remove market: %w", types.NewMarketIsEnabledError(types.TickerString(tickerStr))) - } - return k.markets.Remove(ctx, types.TickerString(tickerStr)) -} - -// DeleteMarket removes a Market. +// DeleteMarket removes a Market. If the market does not exist, this is a no-op. // This is currently only expected to be called in upgrade handlers, and callers will need to separately call // RemoveCurrencyPair on x/oracle to clean up leftover state in that module. func (k *Keeper) DeleteMarket(ctx context.Context, tickerStr string) error { - // Check if Ticker exists - alreadyExists, err := k.markets.Has(ctx, types.TickerString(tickerStr)) - if err != nil { - return err - } - if !alreadyExists { - return types.NewMarketDoesNotExistsError(types.TickerString(tickerStr)) - } return k.markets.Remove(ctx, types.TickerString(tickerStr)) } From 6a53f07834ddad19a1c84c89698b1ee785e63ee3 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:21:05 -0400 Subject: [PATCH 26/35] hooks --- x/marketmap/keeper/keeper.go | 47 ++++++++++++++++------ x/marketmap/keeper/keeper_test.go | 6 +-- x/marketmap/keeper/msg_server.go | 2 +- x/marketmap/keeper/options.go | 21 ++++++++++ x/marketmap/keeper/validation_hooks.go | 1 + x/marketmap/types/validation_hooks.go | 47 ++++++++++++++++++++++ x/marketmap/types/validation_hooks_test.go | 1 + 7 files changed, 109 insertions(+), 16 deletions(-) create mode 100644 x/marketmap/keeper/options.go create mode 100644 x/marketmap/keeper/validation_hooks.go create mode 100644 x/marketmap/types/validation_hooks.go create mode 100644 x/marketmap/types/validation_hooks_test.go diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 17b480643..3d83cb15d 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "errors" "fmt" "cosmossdk.io/collections" @@ -31,10 +32,13 @@ type Keeper struct { // params is the module's parameters. params collections.Item[types.Params] + + // deleteValidationHooks are called by the keeper before any deletion call are performed. + deleteMarketValidationHooks types.MarketValidationHooks } // NewKeeper initializes the keeper and its backing stores. -func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.AccAddress) *Keeper { +func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.AccAddress, opts ...Option) *Keeper { sb := collections.NewSchemaBuilder(ss) // Create the collections item that will track the module parameters. @@ -45,14 +49,22 @@ func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.Acc codec.CollValue[types.Params](cdc), ) - return &Keeper{ - cdc: cdc, - authority: authority, - markets: collections.NewMap(sb, types.MarketsPrefix, "markets", types.TickersCodec, codec.CollValue[types.Market](cdc)), - lastUpdated: collections.NewItem[uint64](sb, types.LastUpdatedPrefix, "last_updated", types.LastUpdatedCodec), - params: params, - hooks: &types.NoopMarketMapHooks{}, + k := &Keeper{ + cdc: cdc, + authority: authority, + markets: collections.NewMap(sb, types.MarketsPrefix, "markets", types.TickersCodec, codec.CollValue[types.Market](cdc)), + lastUpdated: collections.NewItem[uint64](sb, types.LastUpdatedPrefix, "last_updated", types.LastUpdatedCodec), + params: params, + hooks: &types.NoopMarketMapHooks{}, + deleteMarketValidationHooks: types.DefaultDeleteMarketValidationHooks(), + } + + // apply options to default initialized keeper + for _, opt := range opts { + opt(k) } + + return k } // SetLastUpdated sets the lastUpdated field to the current block height. @@ -148,11 +160,22 @@ func (k *Keeper) UpdateMarket(ctx context.Context, market types.Market) error { return k.setMarket(ctx, market) } -// DeleteMarket removes a Market. If the market does not exist, this is a no-op. -// This is currently only expected to be called in upgrade handlers, and callers will need to separately call -// RemoveCurrencyPair on x/oracle to clean up leftover state in that module. +// DeleteMarket removes a Market. If the market does not exist, this is a no-op and nil is returned. +// If the market exists, all DeleteMarketValidationHooks are called on the market before deletion. func (k *Keeper) DeleteMarket(ctx context.Context, tickerStr string) error { - return k.markets.Remove(ctx, types.TickerString(tickerStr)) + market, err := k.GetMarket(ctx, tickerStr) + switch { + case errors.Is(err, collections.ErrNotFound): + return nil + case err != nil: + return fmt.Errorf("failed to get market for ticker %s: %w", tickerStr, err) + } + + if err := k.deleteMarketValidationHooks.ValidateMarket(ctx, market); err != nil { + return err + } + + return k.markets.Remove(ctx, types.TickerString(market.Ticker.String())) } // HasMarket checks if a market exists in the store. diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index 85dbf6c91..90ec2c18e 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -328,17 +328,17 @@ func (s *KeeperTestSuite) TestDeleteDisabledMarket() { s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcCopy)) // invalid delete fails - s.Require().Error(s.keeper.DeleteDisabledMarket(s.ctx, "foobar")) + s.Require().Error(s.keeper.DeleteMarket(s.ctx, "foobar")) // cannot delete enabled markets - s.Require().Error(s.keeper.DeleteDisabledMarket(s.ctx, btcCopy.Ticker.String())) + s.Require().Error(s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String())) // disable market btcCopy.Ticker.Enabled = false s.Require().NoError(s.keeper.UpdateMarket(s.ctx, btcCopy)) // delete disabled markets - s.Require().NoError(s.keeper.DeleteDisabledMarket(s.ctx, btcCopy.Ticker.String())) + s.Require().NoError(s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String())) _, err := s.keeper.GetMarket(s.ctx, btcCopy.Ticker.String()) s.Require().Error(err) } diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 313957669..a303f722d 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -270,7 +270,7 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar } for _, market := range msg.Markets { - if err := ms.k.DeleteDisabledMarket(ctx, market); err != nil { + if err := ms.k.DeleteMarket(ctx, market); err != nil { return nil, fmt.Errorf("unable to delete market: %w", err) } } diff --git a/x/marketmap/keeper/options.go b/x/marketmap/keeper/options.go new file mode 100644 index 000000000..112eaa764 --- /dev/null +++ b/x/marketmap/keeper/options.go @@ -0,0 +1,21 @@ +package keeper + +import "github.com/skip-mev/connect/v2/x/marketmap/types" + +// Option is a type that modifies a keeper during instantiation. These can be passed variadically into NewKeeper +// to specify keeper behavior. +type Option func(*Keeper) + +// WithHooks sets the keeper hooks to the given hooks. +func WithHooks(hooks types.MarketMapHooks) Option { + return func(k *Keeper) { + k.hooks = hooks + } +} + +// WithDeleteValidationHooks sets the keeper deleteMarketValidationHooks to the given hooks. +func WithDeleteValidationHooks(hooks []types.MarketValidationHook) Option { + return func(k *Keeper) { + k.deleteMarketValidationHooks = hooks + } +} diff --git a/x/marketmap/keeper/validation_hooks.go b/x/marketmap/keeper/validation_hooks.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/marketmap/keeper/validation_hooks.go @@ -0,0 +1 @@ +package keeper diff --git a/x/marketmap/types/validation_hooks.go b/x/marketmap/types/validation_hooks.go new file mode 100644 index 000000000..d812aee85 --- /dev/null +++ b/x/marketmap/types/validation_hooks.go @@ -0,0 +1,47 @@ +package types + +import ( + "context" + "fmt" +) + +// MarketValidationHook is a hook that is called for stateful validation of a market before +// some keeper operation is performed on it. +type MarketValidationHook func(ctx context.Context, market Market) error + +// MarketValidationHooks is a type alias for an array of MarketValidationHook. +type MarketValidationHooks []MarketValidationHook + +// ValidateMarket calls all validation hooks for the given market. +func (h MarketValidationHooks) ValidateMarket(ctx context.Context, market Market) error { + for _, hook := range h { + if err := hook(ctx, market); err != nil { + return fmt.Errorf("failed validation hooks for market %s: %w", market.Ticker.String(), err) + } + } + + return nil +} + +// DefaultDeleteMarketValidationHooks returns the default DeleteMarketValidationHook as an array. +func DefaultDeleteMarketValidationHooks() MarketValidationHooks { + hooks := MarketValidationHooks{ + DefaultDeleteMarketValidationHook(), + } + + return hooks +} + +// DefaultDeleteMarketValidationHook returns the default DeleteMarketValidationHook for x/marketmap. +// This hook checks: +// - if the given market is enabled - error +// - if the given market is disabled - return nil. +func DefaultDeleteMarketValidationHook() MarketValidationHook { + return func(_ context.Context, market Market) error { + if market.Ticker.Enabled { + return fmt.Errorf("market is enabled - cannot be deleted") + } + + return nil + } +} diff --git a/x/marketmap/types/validation_hooks_test.go b/x/marketmap/types/validation_hooks_test.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/marketmap/types/validation_hooks_test.go @@ -0,0 +1 @@ +package types From ec18f6d4dca06ba53a77b42ea0e4f310df7796c9 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:26:54 -0400 Subject: [PATCH 27/35] test --- x/marketmap/types/validation_hooks_test.go | 65 +++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/x/marketmap/types/validation_hooks_test.go b/x/marketmap/types/validation_hooks_test.go index ab1254f4c..877a16852 100644 --- a/x/marketmap/types/validation_hooks_test.go +++ b/x/marketmap/types/validation_hooks_test.go @@ -1 +1,64 @@ -package types +package types_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + connecttypes "github.com/skip-mev/connect/v2/pkg/types" + "github.com/skip-mev/connect/v2/x/marketmap/types" +) + +func TestDefaultDeleteMarketValidationHooks_ValidateMarket(t *testing.T) { + tests := []struct { + name string + market types.Market + wantErr bool + }{ + { + name: "valid - disabled market", + market: types.Market{ + Ticker: types.Ticker{ + CurrencyPair: connecttypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", + }, + Decimals: 3, + MinProviderCount: 3, + Enabled: false, + Metadata_JSON: "", + }, + }, + wantErr: false, + }, + { + name: "invalid - enabled market", + market: types.Market{ + Ticker: types.Ticker{ + CurrencyPair: connecttypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", + }, + Decimals: 3, + MinProviderCount: 3, + Enabled: true, + Metadata_JSON: "", + }, + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + hooks := types.DefaultDeleteMarketValidationHooks() + + err := hooks.ValidateMarket(context.Background(), tt.market) + if tt.wantErr { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} From feaf6703352897975b9c8aa2a82ed3d02a40b17c Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:29:10 -0400 Subject: [PATCH 28/35] fix test --- x/marketmap/keeper/keeper_test.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index 90ec2c18e..e22ea32d4 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -321,14 +321,14 @@ func (s *KeeperTestSuite) TestInvalidCreateDisabledNormalizeBy() { s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) } -func (s *KeeperTestSuite) TestDeleteDisabledMarket() { +func (s *KeeperTestSuite) TestDeleteMarket() { // create a valid markets btcCopy := btcusdt btcCopy.Ticker.Enabled = true s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcCopy)) - // invalid delete fails - s.Require().Error(s.keeper.DeleteMarket(s.ctx, "foobar")) + // invalid delete will return nil - idempotent + s.Require().NoError(s.keeper.DeleteMarket(s.ctx, "foobar")) // cannot delete enabled markets s.Require().Error(s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String())) @@ -343,19 +343,6 @@ func (s *KeeperTestSuite) TestDeleteDisabledMarket() { s.Require().Error(err) } -func (s *KeeperTestSuite) TestDeleteMarket() { - // create a valid markets - s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) - - // invalid delete fails - s.Require().Error(s.keeper.DeleteMarket(s.ctx, "foobar")) - - // valid delete works - s.Require().NoError(s.keeper.DeleteMarket(s.ctx, btcusdt.Ticker.String())) - _, err := s.keeper.GetMarket(s.ctx, btcusdt.Ticker.String()) - s.Require().Error(err) -} - func (s *KeeperTestSuite) TestEnableDisableMarket() { // create a valid markets s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) From 41813adcde5ffd8d810eadd682097cb685ca7d58 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:32:16 -0400 Subject: [PATCH 29/35] proto-gen-new --- api/connect/marketmap/v2/tx.pulsar.go | 322 ++++++++++++++++++-------- proto/connect/marketmap/v2/tx.proto | 5 +- x/marketmap/types/tx.pb.go | 150 ++++++++---- 3 files changed, 335 insertions(+), 142 deletions(-) diff --git a/api/connect/marketmap/v2/tx.pulsar.go b/api/connect/marketmap/v2/tx.pulsar.go index 8c5b5f453..b6bbfbccb 100644 --- a/api/connect/marketmap/v2/tx.pulsar.go +++ b/api/connect/marketmap/v2/tx.pulsar.go @@ -4856,15 +4856,15 @@ func (x *_MsgRemoveMarkets_2_list) IsValid() bool { } var ( - md_MsgRemoveMarkets protoreflect.MessageDescriptor - fd_MsgRemoveMarkets_authority protoreflect.FieldDescriptor - fd_MsgRemoveMarkets_markets protoreflect.FieldDescriptor + md_MsgRemoveMarkets protoreflect.MessageDescriptor + fd_MsgRemoveMarkets_admin protoreflect.FieldDescriptor + fd_MsgRemoveMarkets_markets protoreflect.FieldDescriptor ) func init() { file_connect_marketmap_v2_tx_proto_init() md_MsgRemoveMarkets = File_connect_marketmap_v2_tx_proto.Messages().ByName("MsgRemoveMarkets") - fd_MsgRemoveMarkets_authority = md_MsgRemoveMarkets.Fields().ByName("authority") + fd_MsgRemoveMarkets_admin = md_MsgRemoveMarkets.Fields().ByName("admin") fd_MsgRemoveMarkets_markets = md_MsgRemoveMarkets.Fields().ByName("markets") } @@ -4933,9 +4933,9 @@ func (x *fastReflection_MsgRemoveMarkets) Interface() protoreflect.ProtoMessage // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgRemoveMarkets) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgRemoveMarkets_authority, value) { + if x.Admin != "" { + value := protoreflect.ValueOfString(x.Admin) + if !f(fd_MsgRemoveMarkets_admin, value) { return } } @@ -4960,8 +4960,8 @@ func (x *fastReflection_MsgRemoveMarkets) Range(f func(protoreflect.FieldDescrip // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgRemoveMarkets) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarkets.authority": - return x.Authority != "" + case "connect.marketmap.v2.MsgRemoveMarkets.admin": + return x.Admin != "" case "connect.marketmap.v2.MsgRemoveMarkets.markets": return len(x.Markets) != 0 default: @@ -4980,8 +4980,8 @@ func (x *fastReflection_MsgRemoveMarkets) Has(fd protoreflect.FieldDescriptor) b // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarkets) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarkets.authority": - x.Authority = "" + case "connect.marketmap.v2.MsgRemoveMarkets.admin": + x.Admin = "" case "connect.marketmap.v2.MsgRemoveMarkets.markets": x.Markets = nil default: @@ -5000,8 +5000,8 @@ func (x *fastReflection_MsgRemoveMarkets) Clear(fd protoreflect.FieldDescriptor) // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgRemoveMarkets) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "connect.marketmap.v2.MsgRemoveMarkets.authority": - value := x.Authority + case "connect.marketmap.v2.MsgRemoveMarkets.admin": + value := x.Admin return protoreflect.ValueOfString(value) case "connect.marketmap.v2.MsgRemoveMarkets.markets": if len(x.Markets) == 0 { @@ -5029,8 +5029,8 @@ func (x *fastReflection_MsgRemoveMarkets) Get(descriptor protoreflect.FieldDescr // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarkets) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarkets.authority": - x.Authority = value.Interface().(string) + case "connect.marketmap.v2.MsgRemoveMarkets.admin": + x.Admin = value.Interface().(string) case "connect.marketmap.v2.MsgRemoveMarkets.markets": lv := value.List() clv := lv.(*_MsgRemoveMarkets_2_list) @@ -5061,8 +5061,8 @@ func (x *fastReflection_MsgRemoveMarkets) Mutable(fd protoreflect.FieldDescripto } value := &_MsgRemoveMarkets_2_list{list: &x.Markets} return protoreflect.ValueOfList(value) - case "connect.marketmap.v2.MsgRemoveMarkets.authority": - panic(fmt.Errorf("field authority of message connect.marketmap.v2.MsgRemoveMarkets is not mutable")) + case "connect.marketmap.v2.MsgRemoveMarkets.admin": + panic(fmt.Errorf("field admin of message connect.marketmap.v2.MsgRemoveMarkets is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarkets")) @@ -5076,7 +5076,7 @@ func (x *fastReflection_MsgRemoveMarkets) Mutable(fd protoreflect.FieldDescripto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgRemoveMarkets) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarkets.authority": + case "connect.marketmap.v2.MsgRemoveMarkets.admin": return protoreflect.ValueOfString("") case "connect.marketmap.v2.MsgRemoveMarkets.markets": list := []string{} @@ -5150,7 +5150,7 @@ func (x *fastReflection_MsgRemoveMarkets) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Authority) + l = len(x.Admin) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -5198,10 +5198,10 @@ func (x *fastReflection_MsgRemoveMarkets) ProtoMethods() *protoiface.Methods { 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))) + if len(x.Admin) > 0 { + i -= len(x.Admin) + copy(dAtA[i:], x.Admin) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) i-- dAtA[i] = 0xa } @@ -5256,7 +5256,7 @@ func (x *fastReflection_MsgRemoveMarkets) 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 Authority", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5284,7 +5284,7 @@ func (x *fastReflection_MsgRemoveMarkets) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Authority = string(dAtA[iNdEx:postIndex]) + x.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -5353,13 +5353,61 @@ func (x *fastReflection_MsgRemoveMarkets) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MsgRemoveMarketsResponse_1_list)(nil) + +type _MsgRemoveMarketsResponse_1_list struct { + list *[]string +} + +func (x *_MsgRemoveMarketsResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgRemoveMarketsResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_MsgRemoveMarketsResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgRemoveMarketsResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgRemoveMarketsResponse_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveMarketsResponse at list field Markets as it is not of Message kind")) +} + +func (x *_MsgRemoveMarketsResponse_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgRemoveMarketsResponse_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_MsgRemoveMarketsResponse_1_list) IsValid() bool { + return x.list != nil +} + var ( - md_MsgRemoveMarketsResponse protoreflect.MessageDescriptor + md_MsgRemoveMarketsResponse protoreflect.MessageDescriptor + fd_MsgRemoveMarketsResponse_markets protoreflect.FieldDescriptor ) func init() { file_connect_marketmap_v2_tx_proto_init() md_MsgRemoveMarketsResponse = File_connect_marketmap_v2_tx_proto.Messages().ByName("MsgRemoveMarketsResponse") + fd_MsgRemoveMarketsResponse_markets = md_MsgRemoveMarketsResponse.Fields().ByName("markets") } var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketsResponse)(nil) @@ -5427,6 +5475,12 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Interface() protoreflect.Proto // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgRemoveMarketsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Markets) != 0 { + value := protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{list: &x.Markets}) + if !f(fd_MsgRemoveMarketsResponse_markets, value) { + return + } + } } // Has reports whether a field is populated. @@ -5442,6 +5496,8 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Range(f func(protoreflect.Fiel // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgRemoveMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + return len(x.Markets) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5458,6 +5514,8 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Has(fd protoreflect.FieldDescr // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + x.Markets = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5474,6 +5532,12 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Clear(fd protoreflect.FieldDes // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgRemoveMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + if len(x.Markets) == 0 { + return protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{}) + } + listValue := &_MsgRemoveMarketsResponse_1_list{list: &x.Markets} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5494,6 +5558,10 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Get(descriptor protoreflect.Fi // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + lv := value.List() + clv := lv.(*_MsgRemoveMarketsResponse_1_list) + x.Markets = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5514,6 +5582,12 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Set(fd protoreflect.FieldDescr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + if x.Markets == nil { + x.Markets = []string{} + } + value := &_MsgRemoveMarketsResponse_1_list{list: &x.Markets} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5527,6 +5601,9 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Mutable(fd protoreflect.FieldD // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgRemoveMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + list := []string{} + return protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5596,6 +5673,12 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met var n int var l int _ = l + if len(x.Markets) > 0 { + for _, s := range x.Markets { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -5625,6 +5708,15 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Markets) > 0 { + for iNdEx := len(x.Markets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Markets[iNdEx]) + copy(dAtA[i:], x.Markets[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Markets[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -5674,6 +5766,38 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketsResponse: 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 Markets", 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.Markets = append(x.Markets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6125,9 +6249,9 @@ type MsgRemoveMarkets struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // Admin defines the authority that is the x/marketmap + // Admin account. This account is set in the module parameters. + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` // Markets is the list of markets to remove. Markets []string `protobuf:"bytes,2,rep,name=markets,proto3" json:"markets,omitempty"` } @@ -6152,9 +6276,9 @@ func (*MsgRemoveMarkets) Descriptor() ([]byte, []int) { return file_connect_marketmap_v2_tx_proto_rawDescGZIP(), []int{10} } -func (x *MsgRemoveMarkets) GetAuthority() string { +func (x *MsgRemoveMarkets) GetAdmin() string { if x != nil { - return x.Authority + return x.Admin } return "" } @@ -6172,6 +6296,9 @@ type MsgRemoveMarketsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // Markets is the list of markets that were removed. + Markets []string `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty"` } func (x *MsgRemoveMarketsResponse) Reset() { @@ -6194,6 +6321,13 @@ func (*MsgRemoveMarketsResponse) Descriptor() ([]byte, []int) { return file_connect_marketmap_v2_tx_proto_rawDescGZIP(), []int{11} } +func (x *MsgRemoveMarketsResponse) GetMarkets() []string { + if x != nil { + return x.Markets + } + return nil +} + var File_connect_marketmap_v2_tx_proto protoreflect.FileDescriptor var file_connect_marketmap_v2_tx_proto_rawDesc = []byte{ @@ -6287,71 +6421,71 @@ var file_connect_marketmap_v2_tx_proto_rawDesc = []byte{ 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x24, 0x0a, 0x22, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x74, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 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, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x0e, - 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1a, - 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x92, 0x05, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, - 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x2e, 0x0a, 0x05, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 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, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x22, 0x34, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x32, 0x92, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x67, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, + 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, - 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x38, 0x2e, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, - 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x67, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, - 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, + 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, - 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, - 0xc8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x32, 0x3b, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, - 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x32, 0xe2, 0x02, - 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x38, 0x2e, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, + 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, + 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, + 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, + 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc8, 0x01, + 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2f, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x32, 0x3b, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, 0xaa, 0x02, + 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x20, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/connect/marketmap/v2/tx.proto b/proto/connect/marketmap/v2/tx.proto index 5cbc5e1fb..a7f506627 100644 --- a/proto/connect/marketmap/v2/tx.proto +++ b/proto/connect/marketmap/v2/tx.proto @@ -155,4 +155,7 @@ message MsgRemoveMarkets { // MsgRemoveMarketsResponse defines the // Msg/MsgRemoveMarketsResponse response type. -message MsgRemoveMarketsResponse {} +message MsgRemoveMarketsResponse { + // Markets is the list of markets that were removed. + repeated string markets = 1; +} diff --git a/x/marketmap/types/tx.pb.go b/x/marketmap/types/tx.pb.go index 166f82441..72356066c 100644 --- a/x/marketmap/types/tx.pb.go +++ b/x/marketmap/types/tx.pb.go @@ -576,6 +576,8 @@ func (m *MsgRemoveMarkets) GetMarkets() []string { // MsgRemoveMarketsResponse defines the // Msg/MsgRemoveMarketsResponse response type. type MsgRemoveMarketsResponse struct { + // Markets is the list of markets that were removed. + Markets []string `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty"` } func (m *MsgRemoveMarketsResponse) Reset() { *m = MsgRemoveMarketsResponse{} } @@ -611,6 +613,13 @@ func (m *MsgRemoveMarketsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveMarketsResponse proto.InternalMessageInfo +func (m *MsgRemoveMarketsResponse) GetMarkets() []string { + if m != nil { + return m.Markets + } + return nil +} + func init() { proto.RegisterType((*MsgUpsertMarkets)(nil), "connect.marketmap.v2.MsgUpsertMarkets") proto.RegisterType((*MsgUpsertMarketsResponse)(nil), "connect.marketmap.v2.MsgUpsertMarketsResponse") @@ -630,53 +639,53 @@ func init() { func init() { proto.RegisterFile("connect/marketmap/v2/tx.proto", fileDescriptor_37df9476ca9a2f81) } var fileDescriptor_37df9476ca9a2f81 = []byte{ - // 729 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6b, 0x13, 0x4f, - 0x14, 0xcf, 0xa4, 0x4d, 0xbf, 0xdf, 0x8c, 0xa6, 0xb6, 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x76, 0x43, 0x47, 0x9d, 0xc9, 0x3b, 0x54, 0xea, 0x26, 0x29, 0x4c, 0xda, - 0x27, 0x81, 0xbf, 0x22, 0x87, 0x6d, 0x12, 0x64, 0x51, 0x79, 0xa3, 0x84, 0x59, 0xd9, 0xfe, 0x41, - 0xc2, 0xac, 0xd9, 0x7f, 0x92, 0x70, 0x3f, 0x49, 0x61, 0xf2, 0xc1, 0xec, 0x9d, 0x4b, 0x58, 0x90, - 0xc5, 0x09, 0xbf, 0x07, 0xb0, 0xd8, 0x26, 0xe6, 0xb3, 0xf0, 0x42, 0xa2, 0x06, 0x9c, 0x61, 0x57, - 0x33, 0x4c, 0x33, 0x95, 0x29, 0x43, 0x73, 0xa6, 0xdc, 0x42, 0xac, 0x52, 0x3e, 0x73, 0x95, 0x1a, - 0xb3, 0x62, 0x5a, 0xca, 0x55, 0x38, 0x1f, 0x13, 0x8a, 0x69, 0xbe, 0x01, 0x50, 0x6e, 0x13, 0x53, - 0xc7, 0xb6, 0x1b, 0xf0, 0x1c, 0x9a, 0xdc, 0xc2, 0xc2, 0x04, 0xdd, 0x86, 0x73, 0x7e, 0xa8, 0xea, - 0x18, 0x2c, 0x0c, 0xbf, 0x5f, 0x45, 0xfd, 0x0a, 0x93, 0x37, 0x23, 0x31, 0x52, 0x61, 0xc1, 0xe8, - 0xd9, 0x96, 0x73, 0x21, 0x45, 0x06, 0x6b, 0xc0, 0x01, 0x3d, 0x76, 0x56, 0x96, 0xa0, 0x92, 0x4e, - 0x22, 0xe6, 0xba, 0x15, 0x8e, 0x50, 0x12, 0x95, 0x88, 0x0a, 0x32, 0x45, 0x45, 0x92, 0xb8, 0xc6, - 0x8a, 0xc3, 0x15, 0x95, 0xe4, 0xc3, 0x1a, 0x2b, 0x44, 0x8a, 0x58, 0xd4, 0x3f, 0x16, 0xe0, 0x54, - 0x9b, 0x98, 0xc8, 0x84, 0x25, 0xf1, 0xfa, 0xd6, 0x52, 0x37, 0x8e, 0x80, 0x93, 0xd5, 0x6c, 0xb8, - 0x78, 0xc3, 0x99, 0xb0, 0x24, 0x5e, 0x9b, 0xda, 0x98, 0xd5, 0xd6, 0xcb, 0x14, 0x68, 0xe4, 0xc8, - 0xa2, 0x17, 0xf0, 0x32, 0x53, 0xf0, 0xa1, 0xad, 0xa6, 0xda, 0x33, 0x80, 0x7c, 0xeb, 0x02, 0x40, - 0xec, 0xf9, 0x2d, 0x80, 0x0b, 0x69, 0x23, 0xb6, 0x96, 0xea, 0x24, 0xc5, 0x42, 0x5e, 0x9f, 0xd4, - 0x42, 0x2c, 0x65, 0xf2, 0x35, 0xac, 0x65, 0x7b, 0x25, 0xc6, 0x96, 0x72, 0xd4, 0xab, 0x64, 0xc2, - 0x92, 0x38, 0xa7, 0xb5, 0x4c, 0x9c, 0xc7, 0x05, 0x1a, 0x39, 0x8d, 0x72, 0xe1, 0xd5, 0xe9, 0xfe, - 0x0a, 0x68, 0x3d, 0x3d, 0x38, 0xae, 0x80, 0xc3, 0xe3, 0x0a, 0xf8, 0x79, 0x5c, 0x01, 0x1f, 0x4e, - 0x2a, 0xb9, 0xc3, 0x93, 0x4a, 0xee, 0xfb, 0x49, 0x25, 0xf7, 0x72, 0xcd, 0xb4, 0xe8, 0x56, 0x7f, - 0x53, 0xed, 0xba, 0xb6, 0x46, 0xb6, 0x2d, 0x6f, 0xd5, 0xc6, 0x81, 0x16, 0x6d, 0xb7, 0xa0, 0x2e, - 0x2c, 0x38, 0xba, 0xe7, 0x61, 0xb2, 0x39, 0x13, 0xfe, 0x7a, 0xb8, 0xfb, 0x3b, 0x00, 0x00, 0xff, - 0xff, 0x75, 0xad, 0x0c, 0x3c, 0x17, 0x09, 0x00, 0x00, + // 733 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, + 0x14, 0xef, 0x14, 0x8a, 0x76, 0xb4, 0x08, 0x63, 0x13,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, 0x62, 0x57, 0x52, 0x77, 0x91, 0x84, + 0x53, 0xf5, 0xd1, 0x70, 0x31, 0x15, 0x1b, 0x16, 0xe4, 0x0b, 0x55, 0x19, 0xb2, 0xf4, 0x3a, 0x23, + 0x05, 0x1a, 0x38, 0xcc, 0xe8, 0x25, 0xbc, 0xcc, 0x15, 0x62, 0x9c, 0xcb, 0xa9, 0xf6, 0x1c, 0xa0, + 0xde, 0x3a, 0x07, 0x10, 0x7b, 0x7e, 0x07, 0xe0, 0x5c, 0xda, 0xf0, 0xad, 0xa4, 0x3a, 0x49, 0xb1, + 0x50, 0x57, 0xc7, 0xb5, 0x90, 0x4b, 0x99, 0x7c, 0x27, 0x2b, 0xa3, 0xbd, 0x1f, 0x43, 0x4b, 0x39, + 0xe8, 0xbd, 0xb2, 0x61, 0x41, 0x9e, 0xe0, 0xca, 0x48, 0x9c, 0x87, 0x05, 0x1a, 0x38, 0xa7, 0x6a, + 0xee, 0xf5, 0xf1, 0xee, 0x12, 0x68, 0x3c, 0xdb, 0x3b, 0x2c, 0x81, 0xfd, 0xc3, 0x12, 0xf8, 0x75, + 0x58, 0x02, 0x1f, 0x8f, 0x4a, 0x99, 0xfd, 0xa3, 0x52, 0xe6, 0xc7, 0x51, 0x29, 0xf3, 0x6a, 0xc5, + 0x76, 0xe8, 0x46, 0x77, 0x5d, 0x6f, 0xfb, 0xae, 0x41, 0x36, 0x9d, 0x60, 0xd9, 0xc5, 0x91, 0xd1, + 0xdf, 0x7b, 0x51, 0x55, 0x5a, 0x7d, 0x74, 0x27, 0xc0, 0x64, 0x7d, 0x8a, 0xfd, 0xae, 0xb8, 0xfb, + 0x27, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x52, 0xac, 0x84, 0x31, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1376,6 +1385,15 @@ func (m *MsgRemoveMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if len(m.Markets) > 0 { + for iNdEx := len(m.Markets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Markets[iNdEx]) + copy(dAtA[i:], m.Markets[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Markets[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } return len(dAtA) - i, nil } @@ -1559,6 +1577,12 @@ func (m *MsgRemoveMarketsResponse) Size() (n int) { } var l int _ = l + if len(m.Markets) > 0 { + for _, s := range m.Markets { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -2653,6 +2677,38 @@ func (m *MsgRemoveMarketsResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgRemoveMarketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Markets = append(m.Markets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 7e38f7537dc221ed3403421acaa35f79f890e084 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:36:19 -0400 Subject: [PATCH 30/35] track deleted markets --- x/marketmap/keeper/keeper.go | 16 +++++++++++----- x/marketmap/keeper/msg_server.go | 12 ++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 3d83cb15d..2d405134c 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -162,20 +162,26 @@ func (k *Keeper) UpdateMarket(ctx context.Context, market types.Market) error { // DeleteMarket removes a Market. If the market does not exist, this is a no-op and nil is returned. // If the market exists, all DeleteMarketValidationHooks are called on the market before deletion. -func (k *Keeper) DeleteMarket(ctx context.Context, tickerStr string) error { +// Additionally, returns a bool if the market was deleted. +func (k *Keeper) DeleteMarket(ctx context.Context, tickerStr string) (bool, error) { market, err := k.GetMarket(ctx, tickerStr) switch { case errors.Is(err, collections.ErrNotFound): - return nil + return false, nil case err != nil: - return fmt.Errorf("failed to get market for ticker %s: %w", tickerStr, err) + return false, fmt.Errorf("failed to get market for ticker %s: %w", tickerStr, err) } if err := k.deleteMarketValidationHooks.ValidateMarket(ctx, market); err != nil { - return err + return false, err + } + + err = k.markets.Remove(ctx, types.TickerString(market.Ticker.String())) + if err != nil { + return false, err } - return k.markets.Remove(ctx, types.TickerString(market.Ticker.String())) + return true, nil } // HasMarket checks if a market exists in the store. diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index a303f722d..fe9e9614e 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -269,10 +269,16 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar return nil, fmt.Errorf("request admin %s does not match module admin %s", msg.Admin, params.Admin) } + deletedMarkets := make([]string, 0, len(msg.Markets)) for _, market := range msg.Markets { - if err := ms.k.DeleteMarket(ctx, market); err != nil { + deleted, err := ms.k.DeleteMarket(ctx, market) + if err != nil { return nil, fmt.Errorf("unable to delete market: %w", err) } + + if deleted { + deletedMarkets = append(deletedMarkets, market) + } } // check if the resulting state is valid: it may not be valid if the removed market is used as a normalization pair @@ -286,7 +292,9 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar return nil, fmt.Errorf("invalid state resulting from removals: %w", err) } - return &types.MsgRemoveMarketsResponse{}, nil + return &types.MsgRemoveMarketsResponse{ + Markets: deletedMarkets, + }, nil } // checkMarketAuthority checks if the given authority is the x/marketmap's list of MarketAuthorities. From 1c5773512e85b31fa7aba7a74ebfcce54975bc06 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:52:32 -0400 Subject: [PATCH 31/35] tested --- api/connect/marketmap/v2/tx.pulsar.go | 179 +++++++++++++------------- proto/connect/marketmap/v2/tx.proto | 4 +- x/marketmap/keeper/keeper.go | 4 +- x/marketmap/keeper/keeper_test.go | 15 ++- x/marketmap/keeper/msg_server.go | 2 +- x/marketmap/keeper/msg_server_test.go | 16 +-- x/marketmap/types/tx.pb.go | 119 ++++++++--------- 7 files changed, 174 insertions(+), 165 deletions(-) diff --git a/api/connect/marketmap/v2/tx.pulsar.go b/api/connect/marketmap/v2/tx.pulsar.go index b6bbfbccb..8f48f9f99 100644 --- a/api/connect/marketmap/v2/tx.pulsar.go +++ b/api/connect/marketmap/v2/tx.pulsar.go @@ -5383,7 +5383,7 @@ func (x *_MsgRemoveMarketsResponse_1_list) Append(value protoreflect.Value) { } func (x *_MsgRemoveMarketsResponse_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveMarketsResponse at list field Markets as it is not of Message kind")) + panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveMarketsResponse at list field DeletedMarkets as it is not of Message kind")) } func (x *_MsgRemoveMarketsResponse_1_list) Truncate(n int) { @@ -5400,14 +5400,14 @@ func (x *_MsgRemoveMarketsResponse_1_list) IsValid() bool { } var ( - md_MsgRemoveMarketsResponse protoreflect.MessageDescriptor - fd_MsgRemoveMarketsResponse_markets protoreflect.FieldDescriptor + md_MsgRemoveMarketsResponse protoreflect.MessageDescriptor + fd_MsgRemoveMarketsResponse_deleted_markets protoreflect.FieldDescriptor ) func init() { file_connect_marketmap_v2_tx_proto_init() md_MsgRemoveMarketsResponse = File_connect_marketmap_v2_tx_proto.Messages().ByName("MsgRemoveMarketsResponse") - fd_MsgRemoveMarketsResponse_markets = md_MsgRemoveMarketsResponse.Fields().ByName("markets") + fd_MsgRemoveMarketsResponse_deleted_markets = md_MsgRemoveMarketsResponse.Fields().ByName("deleted_markets") } var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketsResponse)(nil) @@ -5475,9 +5475,9 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Interface() protoreflect.Proto // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgRemoveMarketsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Markets) != 0 { - value := protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{list: &x.Markets}) - if !f(fd_MsgRemoveMarketsResponse_markets, value) { + if len(x.DeletedMarkets) != 0 { + value := protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{list: &x.DeletedMarkets}) + if !f(fd_MsgRemoveMarketsResponse_deleted_markets, value) { return } } @@ -5496,8 +5496,8 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Range(f func(protoreflect.Fiel // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgRemoveMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": - return len(x.Markets) != 0 + case "connect.marketmap.v2.MsgRemoveMarketsResponse.deleted_markets": + return len(x.DeletedMarkets) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5514,8 +5514,8 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Has(fd protoreflect.FieldDescr // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": - x.Markets = nil + case "connect.marketmap.v2.MsgRemoveMarketsResponse.deleted_markets": + x.DeletedMarkets = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5532,11 +5532,11 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Clear(fd protoreflect.FieldDes // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgRemoveMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": - if len(x.Markets) == 0 { + case "connect.marketmap.v2.MsgRemoveMarketsResponse.deleted_markets": + if len(x.DeletedMarkets) == 0 { return protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{}) } - listValue := &_MsgRemoveMarketsResponse_1_list{list: &x.Markets} + listValue := &_MsgRemoveMarketsResponse_1_list{list: &x.DeletedMarkets} return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { @@ -5558,10 +5558,10 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Get(descriptor protoreflect.Fi // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + case "connect.marketmap.v2.MsgRemoveMarketsResponse.deleted_markets": lv := value.List() clv := lv.(*_MsgRemoveMarketsResponse_1_list) - x.Markets = *clv.list + x.DeletedMarkets = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: connect.marketmap.v2.MsgRemoveMarketsResponse")) @@ -5582,11 +5582,11 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Set(fd protoreflect.FieldDescr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgRemoveMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": - if x.Markets == nil { - x.Markets = []string{} + case "connect.marketmap.v2.MsgRemoveMarketsResponse.deleted_markets": + if x.DeletedMarkets == nil { + x.DeletedMarkets = []string{} } - value := &_MsgRemoveMarketsResponse_1_list{list: &x.Markets} + value := &_MsgRemoveMarketsResponse_1_list{list: &x.DeletedMarkets} return protoreflect.ValueOfList(value) default: if fd.IsExtension() { @@ -5601,7 +5601,7 @@ func (x *fastReflection_MsgRemoveMarketsResponse) Mutable(fd protoreflect.FieldD // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgRemoveMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "connect.marketmap.v2.MsgRemoveMarketsResponse.markets": + case "connect.marketmap.v2.MsgRemoveMarketsResponse.deleted_markets": list := []string{} return protoreflect.ValueOfList(&_MsgRemoveMarketsResponse_1_list{list: &list}) default: @@ -5673,8 +5673,8 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met var n int var l int _ = l - if len(x.Markets) > 0 { - for _, s := range x.Markets { + if len(x.DeletedMarkets) > 0 { + for _, s := range x.DeletedMarkets { l = len(s) n += 1 + l + runtime.Sov(uint64(l)) } @@ -5708,11 +5708,11 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Markets) > 0 { - for iNdEx := len(x.Markets) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Markets[iNdEx]) - copy(dAtA[i:], x.Markets[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Markets[iNdEx]))) + if len(x.DeletedMarkets) > 0 { + for iNdEx := len(x.DeletedMarkets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.DeletedMarkets[iNdEx]) + copy(dAtA[i:], x.DeletedMarkets[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DeletedMarkets[iNdEx]))) i-- dAtA[i] = 0xa } @@ -5768,7 +5768,7 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DeletedMarkets", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5796,7 +5796,7 @@ func (x *fastReflection_MsgRemoveMarketsResponse) ProtoMethods() *protoiface.Met if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Markets = append(x.Markets, string(dAtA[iNdEx:postIndex])) + x.DeletedMarkets = append(x.DeletedMarkets, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -6297,8 +6297,8 @@ type MsgRemoveMarketsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Markets is the list of markets that were removed. - Markets []string `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty"` + // DeletedMarkets is the list of markets that were removed. + DeletedMarkets []string `protobuf:"bytes,1,rep,name=deleted_markets,json=deletedMarkets,proto3" json:"deleted_markets,omitempty"` } func (x *MsgRemoveMarketsResponse) Reset() { @@ -6321,9 +6321,9 @@ func (*MsgRemoveMarketsResponse) Descriptor() ([]byte, []int) { return file_connect_marketmap_v2_tx_proto_rawDescGZIP(), []int{11} } -func (x *MsgRemoveMarketsResponse) GetMarkets() []string { +func (x *MsgRemoveMarketsResponse) GetDeletedMarkets() []string { if x != nil { - return x.Markets + return x.DeletedMarkets } return nil } @@ -6428,64 +6428,65 @@ var file_connect_marketmap_v2_tx_proto_rawDesc = []byte{ 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x22, 0x34, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x32, 0x92, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x67, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, + 0x69, 0x6e, 0x22, 0x43, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, + 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x32, 0x92, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x67, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, + 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, - 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, - 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, - 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, - 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x38, 0x2e, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, - 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x17, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, + 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x38, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, + 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0d, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, - 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, - 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, - 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc8, 0x01, - 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2f, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x32, 0x3b, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, 0xaa, 0x02, - 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x20, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc8, 0x01, 0x0a, + 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x32, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2f, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x32, 0x3b, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, 0xaa, 0x02, 0x14, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x20, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, + 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/connect/marketmap/v2/tx.proto b/proto/connect/marketmap/v2/tx.proto index a7f506627..491aaaef2 100644 --- a/proto/connect/marketmap/v2/tx.proto +++ b/proto/connect/marketmap/v2/tx.proto @@ -156,6 +156,6 @@ message MsgRemoveMarkets { // MsgRemoveMarketsResponse defines the // Msg/MsgRemoveMarketsResponse response type. message MsgRemoveMarketsResponse { - // Markets is the list of markets that were removed. - repeated string markets = 1; + // DeletedMarkets is the list of markets that were removed. + repeated string deleted_markets = 1; } diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 2d405134c..da47e98f2 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -146,7 +146,7 @@ func (k *Keeper) CreateMarket(ctx context.Context, market types.Market) error { } // UpdateMarket updates a Market. -// The Ticker.String corresponds to a market, and exist unique. +// The Ticker.String corresponds to a market, and exists uniquely. func (k *Keeper) UpdateMarket(ctx context.Context, market types.Market) error { // Check if Ticker already exists for the provider alreadyExists, err := k.markets.Has(ctx, types.TickerString(market.Ticker.String())) @@ -162,7 +162,7 @@ func (k *Keeper) UpdateMarket(ctx context.Context, market types.Market) error { // DeleteMarket removes a Market. If the market does not exist, this is a no-op and nil is returned. // If the market exists, all DeleteMarketValidationHooks are called on the market before deletion. -// Additionally, returns a bool if the market was deleted. +// Additionally, returns true if the market was deleted. func (k *Keeper) DeleteMarket(ctx context.Context, tickerStr string) (bool, error) { market, err := k.GetMarket(ctx, tickerStr) switch { diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index e22ea32d4..118d311e0 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -328,18 +328,25 @@ func (s *KeeperTestSuite) TestDeleteMarket() { s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcCopy)) // invalid delete will return nil - idempotent - s.Require().NoError(s.keeper.DeleteMarket(s.ctx, "foobar")) + deleted, err := s.keeper.DeleteMarket(s.ctx, "foobar") + s.Require().NoError(err) + s.Require().False(deleted) // cannot delete enabled markets - s.Require().Error(s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String())) + deleted, err = s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String()) + s.Require().Error(err) + s.Require().False(deleted) // disable market btcCopy.Ticker.Enabled = false s.Require().NoError(s.keeper.UpdateMarket(s.ctx, btcCopy)) // delete disabled markets - s.Require().NoError(s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String())) - _, err := s.keeper.GetMarket(s.ctx, btcCopy.Ticker.String()) + deleted, err = s.keeper.DeleteMarket(s.ctx, btcCopy.Ticker.String()) + s.Require().NoError(err) + s.Require().True(deleted) + + _, err = s.keeper.GetMarket(s.ctx, btcCopy.Ticker.String()) s.Require().Error(err) } diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index fe9e9614e..cd146b302 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -293,7 +293,7 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar } return &types.MsgRemoveMarketsResponse{ - Markets: deletedMarkets, + DeletedMarkets: deletedMarkets, }, nil } diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index f44e55be0..6ee63330a 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -538,14 +538,14 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { s.Require().Nil(resp) }) - s.Run("unable to remove non-existent market - multiple", func() { + s.Run("only remove existing markets - no error", func() { msg := &types.MsgRemoveMarkets{ Admin: s.admin, Markets: []string{"BTC/USD", "ETH/USDT"}, } resp, err := msgServer.RemoveMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) + s.Require().NoError(err) + s.Require().Equal([]string{}, resp.DeletedMarkets) }) s.Run("unable to remove non-existent market - single", func() { @@ -554,8 +554,8 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { Markets: []string{"BTC/USD"}, } resp, err := msgServer.RemoveMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) + s.Require().NoError(err) + s.Require().Equal([]string{}, resp.DeletedMarkets) }) s.Run("able to remove disabled market", func() { @@ -572,14 +572,14 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { resp, err := msgServer.RemoveMarkets(s.ctx, msg) s.Require().NoError(err) - s.Require().NotNil(resp) + s.Require().Equal([]string{copyBTC.Ticker.String()}, resp.DeletedMarkets) // market should not exist _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) s.Require().Error(err) }) - s.Run("unable to remove enabled market", func() { + s.Run("do not remove enabled market", func() { copyBTC := btcusdt copyBTC.Ticker.Enabled = true @@ -608,7 +608,7 @@ func (s *KeeperTestSuite) TestMsgServerRemoveMarkets() { // remove resp, err = msgServer.RemoveMarkets(s.ctx, msg) s.Require().NoError(err) - s.Require().NotNil(resp) + s.Require().Equal([]string{copyBTC.Ticker.String()}, resp.DeletedMarkets) // market should not exist _, err = s.keeper.GetMarket(s.ctx, copyBTC.Ticker.String()) diff --git a/x/marketmap/types/tx.pb.go b/x/marketmap/types/tx.pb.go index 72356066c..f4fd87c57 100644 --- a/x/marketmap/types/tx.pb.go +++ b/x/marketmap/types/tx.pb.go @@ -576,8 +576,8 @@ func (m *MsgRemoveMarkets) GetMarkets() []string { // MsgRemoveMarketsResponse defines the // Msg/MsgRemoveMarketsResponse response type. type MsgRemoveMarketsResponse struct { - // Markets is the list of markets that were removed. - Markets []string `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty"` + // DeletedMarkets is the list of markets that were removed. + DeletedMarkets []string `protobuf:"bytes,1,rep,name=deleted_markets,json=deletedMarkets,proto3" json:"deleted_markets,omitempty"` } func (m *MsgRemoveMarketsResponse) Reset() { *m = MsgRemoveMarketsResponse{} } @@ -613,9 +613,9 @@ func (m *MsgRemoveMarketsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveMarketsResponse proto.InternalMessageInfo -func (m *MsgRemoveMarketsResponse) GetMarkets() []string { +func (m *MsgRemoveMarketsResponse) GetDeletedMarkets() []string { if m != nil { - return m.Markets + return m.DeletedMarkets } return nil } @@ -639,53 +639,54 @@ func init() { func init() { proto.RegisterFile("connect/marketmap/v2/tx.proto", fileDescriptor_37df9476ca9a2f81) } var fileDescriptor_37df9476ca9a2f81 = []byte{ - // 733 bytes of a gzipped FileDescriptorProto + // 745 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, - 0x14, 0xef, 0x14, 0x8a, 0x76, 0xb4, 0x08, 0x63, 0x13, 0xd6, 0x8d, 0xb6, 0xb8, 0x21, 0x15, 0x49, - 0xd8, 0xc5, 0x6a, 0x0c, 0xa9, 0x1e, 0x6c, 0x8d, 0x07, 0x4d, 0x9a, 0x98, 0x35, 0x24, 0xc6, 0x4b, - 0xb3, 0xb4, 0x93, 0x65, 0x03, 0xfb, 0x27, 0x3b, 0xd3, 0x0d, 0xdc, 0x8c, 0xc6, 0x8b, 0x17, 0x8d, - 0x27, 0x8f, 0xfa, 0x0d, 0x38, 0xf8, 0x15, 0x4c, 0x38, 0x12, 0x4e, 0x9e, 0x8c, 0x81, 0x03, 0x7e, - 0x0c, 0xd3, 0x99, 0xe9, 0xb2, 0x03, 0xdd, 0xd2, 0xaa, 0x17, 0x98, 0x7d, 0xef, 0xf7, 0xde, 0xfb, - 0xbd, 0x3f, 0xf3, 0xa6, 0xf0, 0x46, 0xdb, 0xf7, 0x3c, 0xdc, 0xa6, 0x86, 0x6b, 0x85, 0x9b, 0x98, - 0xba, 0x56, 0x60, 0x44, 0x55, 0x83, 0x6e, 0xeb, 0x41, 0xe8, 0x53, 0x1f, 0x15, 0x85, 0x5a, 0x8f, - 0xd5, 0x7a, 0x54, 0x55, 0xe7, 0xda, 0x3e, 0x71, 0x7d, 0x62, 0xb8, 0xc4, 0x36, 0xa2, 0x3b, 0xbd, - 0x7f, 0x1c, 0xae, 0x16, 0x6d, 0xdf, 0xf6, 0xd9, 0xd1, 0xe8, 0x9d, 0x84, 0xf4, 0x1a, 0x87, 0xb7, - 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, 0xe9, 0x62, 0x29, 0x3b, 0x0f, 0x96, 0xae, 0xea, 0xec, 0xa3, 0x9e, 0x5d, 0x03, 0xf5, + 0xc9, 0xcf, 0x5f, 0x2b, 0x40, 0x39, 0x62, 0xad, 0x59, 0x0f, 0xb0, 0x41, 0xf1, 0xbf, 0xb6, 0xe6, + 0x29, 0x2c, 0x76, 0x22, 0x47, 0xed, 0xf1, 0x3b, 0x54, 0xe8, 0x24, 0x29, 0x8c, 0xdb, 0x27, 0x81, + 0xbf, 0x22, 0x47, 0x6d, 0x12, 0x64, 0xfd, 0xf2, 0xf6, 0x13, 0x66, 0x65, 0xfb, 0x0f, 0x09, 0xb3, + 0x66, 0xff, 0x4d, 0xc2, 0xdd, 0x24, 0x85, 0xf1, 0x07, 0xd3, 0xbc, 0x90, 0xb0, 0x20, 0x8b, 0x13, + 0xfe, 0x00, 0x60, 0xbe, 0x45, 0xac, 0xe7, 0xd1, 0x85, 0x44, 0x75, 0x38, 0xc5, 0xae, 0x66, 0x94, + 0x66, 0x2a, 0x53, 0x86, 0xe6, 0x4c, 0xb9, 0x85, 0x58, 0xa5, 0xec, 0xc8, 0x55, 0xaa, 0x17, 0xc5, + 0xb4, 0x94, 0x1b, 0x70, 0x36, 0x26, 0x14, 0xd3, 0x7c, 0x0b, 0xa0, 0xdc, 0x22, 0x96, 0x8e, 0x1d, + 0x2f, 0xe4, 0x39, 0x34, 0xb8, 0x85, 0x8d, 0x09, 0xba, 0x0b, 0x67, 0x82, 0x48, 0xd5, 0x36, 0x58, + 0x18, 0x7e, 0xbf, 0xf2, 0xfa, 0x34, 0x93, 0x37, 0xfa, 0x62, 0xa4, 0xc2, 0x9c, 0x61, 0x3a, 0xb6, + 0x7b, 0x29, 0x45, 0x06, 0xab, 0xc3, 0x1e, 0x3d, 0x76, 0x56, 0x16, 0xa0, 0x92, 0x4e, 0x22, 0xe6, + 0xba, 0x15, 0x8d, 0x50, 0x12, 0x95, 0x88, 0x0a, 0x46, 0x8a, 0x8a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 0xf7, 0x7c, 0x4c, 0x36, 0xa7, 0xa2, 0x9f, 0x19, 0xf7, 0xff, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x17, 0x6d, 0xc6, 0xd8, 0x40, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1385,11 +1386,11 @@ func (m *MsgRemoveMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if len(m.Markets) > 0 { - for iNdEx := len(m.Markets) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Markets[iNdEx]) - copy(dAtA[i:], m.Markets[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Markets[iNdEx]))) + if len(m.DeletedMarkets) > 0 { + for iNdEx := len(m.DeletedMarkets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.DeletedMarkets[iNdEx]) + copy(dAtA[i:], m.DeletedMarkets[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.DeletedMarkets[iNdEx]))) i-- dAtA[i] = 0xa } @@ -1577,8 +1578,8 @@ func (m *MsgRemoveMarketsResponse) Size() (n int) { } var l int _ = l - if len(m.Markets) > 0 { - for _, s := range m.Markets { + if len(m.DeletedMarkets) > 0 { + for _, s := range m.DeletedMarkets { l = len(s) n += 1 + l + sovTx(uint64(l)) } @@ -2679,7 +2680,7 @@ func (m *MsgRemoveMarketsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeletedMarkets", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2707,7 +2708,7 @@ func (m *MsgRemoveMarketsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Markets = append(m.Markets, string(dAtA[iNdEx:postIndex])) + m.DeletedMarkets = append(m.DeletedMarkets, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex From f87466eb6f1cf711cf824724ace8dc0de9105312 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:56:54 -0400 Subject: [PATCH 32/35] e2e --- tests/integration/connect_setup.go | 3 ++- tests/integration/connect_suite.go | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/integration/connect_setup.go b/tests/integration/connect_setup.go index 225acb6cc..d346c01b4 100644 --- a/tests/integration/connect_setup.go +++ b/tests/integration/connect_setup.go @@ -426,7 +426,8 @@ func (s *ConnectIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, us return nil } -func (s *ConnectIntegrationSuite) RemoveMarket(chain *cosmos.CosmosChain, user cosmos.User, +func (s *ConnectIntegrationSuite) RemoveMarket( + chain *cosmos.CosmosChain, markets []connecttypes.CurrencyPair, ) error { marketString := make([]string, len(markets)) diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index 390e8e408..1c3ed7ca1 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -374,7 +374,7 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { s.Require().True(len(resp.CurrencyPairs) == 3) s.Run("fail to remove an enabled market", func() { - s.Require().Error(s.RemoveMarket(s.chain, s.user, []connecttypes.CurrencyPair{cp1})) + s.Require().Error(s.RemoveMarket(s.chain, []connecttypes.CurrencyPair{cp1})) // check not removed market, err := QueryMarket(s.chain, cp1) @@ -393,12 +393,22 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { s.Require().NoError(err) s.Require().NotNil(market) - s.Require().NoError(s.RemoveMarket(s.chain, s.user, []connecttypes.CurrencyPair{disabledCP})) + s.Require().NoError(s.RemoveMarket(s.chain, []connecttypes.CurrencyPair{disabledCP})) // check removed _, err = QueryMarket(s.chain, disabledCP) s.Require().Error(err) }) + + s.Run("remove a non existent market", func() { + nonexistentCP := connecttypes.NewCurrencyPair("NON", "EXIST") + + // check removed doesnt exist + _, err := QueryMarket(s.chain, nonexistentCP) + s.Require().Error(err) + + s.Require().NoError(s.RemoveMarket(s.chain, []connecttypes.CurrencyPair{nonexistentCP})) + }) } func translateGRPCAddr(chain *cosmos.CosmosChain) string { From 439f28ddb8dab4d4812ca5a3e863dd6cf6c7fea6 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 11:57:22 -0400 Subject: [PATCH 33/35] nice --- tests/integration/connect_suite.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/connect_suite.go b/tests/integration/connect_suite.go index 1c3ed7ca1..b63f1d621 100644 --- a/tests/integration/connect_suite.go +++ b/tests/integration/connect_suite.go @@ -407,6 +407,7 @@ func (s *ConnectOracleIntegrationSuite) TestOracleModule() { _, err := QueryMarket(s.chain, nonexistentCP) s.Require().Error(err) + // tx will not error s.Require().NoError(s.RemoveMarket(s.chain, []connecttypes.CurrencyPair{nonexistentCP})) }) } From 69bed9fb81f799e82fc60ca58edba5006224d7f4 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 12:00:59 -0400 Subject: [PATCH 34/35] add helper set method --- x/marketmap/keeper/keeper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index da47e98f2..258eaf1c4 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -67,6 +67,11 @@ func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.Acc return k } +// SetDeleteMarketValidationHooks sets the MarketValidationHooks for deletion in the keeper. +func (k *Keeper) SetDeleteMarketValidationHooks(hooks types.MarketValidationHooks) { + k.deleteMarketValidationHooks = hooks +} + // SetLastUpdated sets the lastUpdated field to the current block height. func (k *Keeper) SetLastUpdated(ctx context.Context, height uint64) error { return k.lastUpdated.Set(ctx, height) From 846cd228800e448e15dd7460793ac0ab3617b531 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Fri, 27 Sep 2024 12:07:36 -0400 Subject: [PATCH 35/35] clean --- x/marketmap/keeper/keeper.go | 2 +- x/marketmap/keeper/msg_server.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 258eaf1c4..2abfb7253 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -33,7 +33,7 @@ type Keeper struct { // params is the module's parameters. params collections.Item[types.Params] - // deleteValidationHooks are called by the keeper before any deletion call are performed. + // deleteValidationHooks are called by the keeper before any deletion call is performed. deleteMarketValidationHooks types.MarketValidationHooks } diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index cd146b302..960bfdf6b 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -250,9 +250,12 @@ func (ms msgServer) RemoveMarketAuthorities(goCtx context.Context, msg *types.Ms return &types.MsgRemoveMarketAuthoritiesResponse{}, nil } -// RemoveMarkets attempts to remove all currently non-enabled markets from the market map. -func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMarkets) (*types.MsgRemoveMarketsResponse, - error, +// RemoveMarkets attempts to remove the provided markets from the MarketMap. Stateful validation is performed on these +// markets using the configured ValidationHooks. +func (ms msgServer) RemoveMarkets( + goCtx context.Context, + msg *types.MsgRemoveMarkets) ( + *types.MsgRemoveMarketsResponse, error, ) { if msg == nil { return nil, fmt.Errorf("unable to process nil msg") @@ -277,6 +280,7 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar } if deleted { + ctx.Logger().Info(fmt.Sprintf("deleted market %s", market)) deletedMarkets = append(deletedMarkets, market) } }