diff --git a/api/band/tunnel/v1beta1/route.pulsar.go b/api/band/tunnel/v1beta1/route.pulsar.go index c22fc2455..346a99d24 100644 --- a/api/band/tunnel/v1beta1/route.pulsar.go +++ b/api/band/tunnel/v1beta1/route.pulsar.go @@ -1727,83 +1727,83 @@ func (x *fastReflection_IBCPacketReceipt) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_IBCPacket_3_list)(nil) +var _ protoreflect.List = (*_TunnelPricesPacketData_3_list)(nil) -type _IBCPacket_3_list struct { +type _TunnelPricesPacketData_3_list struct { list *[]*v1beta1.Price } -func (x *_IBCPacket_3_list) Len() int { +func (x *_TunnelPricesPacketData_3_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_IBCPacket_3_list) Get(i int) protoreflect.Value { +func (x *_TunnelPricesPacketData_3_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_IBCPacket_3_list) Set(i int, value protoreflect.Value) { +func (x *_TunnelPricesPacketData_3_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*v1beta1.Price) (*x.list)[i] = concreteValue } -func (x *_IBCPacket_3_list) Append(value protoreflect.Value) { +func (x *_TunnelPricesPacketData_3_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*v1beta1.Price) *x.list = append(*x.list, concreteValue) } -func (x *_IBCPacket_3_list) AppendMutable() protoreflect.Value { +func (x *_TunnelPricesPacketData_3_list) AppendMutable() protoreflect.Value { v := new(v1beta1.Price) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_IBCPacket_3_list) Truncate(n int) { +func (x *_TunnelPricesPacketData_3_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_IBCPacket_3_list) NewElement() protoreflect.Value { +func (x *_TunnelPricesPacketData_3_list) NewElement() protoreflect.Value { v := new(v1beta1.Price) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_IBCPacket_3_list) IsValid() bool { +func (x *_TunnelPricesPacketData_3_list) IsValid() bool { return x.list != nil } var ( - md_IBCPacket protoreflect.MessageDescriptor - fd_IBCPacket_tunnel_id protoreflect.FieldDescriptor - fd_IBCPacket_sequence protoreflect.FieldDescriptor - fd_IBCPacket_prices protoreflect.FieldDescriptor - fd_IBCPacket_created_at protoreflect.FieldDescriptor + md_TunnelPricesPacketData protoreflect.MessageDescriptor + fd_TunnelPricesPacketData_tunnel_id protoreflect.FieldDescriptor + fd_TunnelPricesPacketData_sequence protoreflect.FieldDescriptor + fd_TunnelPricesPacketData_prices protoreflect.FieldDescriptor + fd_TunnelPricesPacketData_created_at protoreflect.FieldDescriptor ) func init() { file_band_tunnel_v1beta1_route_proto_init() - md_IBCPacket = File_band_tunnel_v1beta1_route_proto.Messages().ByName("IBCPacket") - fd_IBCPacket_tunnel_id = md_IBCPacket.Fields().ByName("tunnel_id") - fd_IBCPacket_sequence = md_IBCPacket.Fields().ByName("sequence") - fd_IBCPacket_prices = md_IBCPacket.Fields().ByName("prices") - fd_IBCPacket_created_at = md_IBCPacket.Fields().ByName("created_at") + md_TunnelPricesPacketData = File_band_tunnel_v1beta1_route_proto.Messages().ByName("TunnelPricesPacketData") + fd_TunnelPricesPacketData_tunnel_id = md_TunnelPricesPacketData.Fields().ByName("tunnel_id") + fd_TunnelPricesPacketData_sequence = md_TunnelPricesPacketData.Fields().ByName("sequence") + fd_TunnelPricesPacketData_prices = md_TunnelPricesPacketData.Fields().ByName("prices") + fd_TunnelPricesPacketData_created_at = md_TunnelPricesPacketData.Fields().ByName("created_at") } -var _ protoreflect.Message = (*fastReflection_IBCPacket)(nil) +var _ protoreflect.Message = (*fastReflection_TunnelPricesPacketData)(nil) -type fastReflection_IBCPacket IBCPacket +type fastReflection_TunnelPricesPacketData TunnelPricesPacketData -func (x *IBCPacket) ProtoReflect() protoreflect.Message { - return (*fastReflection_IBCPacket)(x) +func (x *TunnelPricesPacketData) ProtoReflect() protoreflect.Message { + return (*fastReflection_TunnelPricesPacketData)(x) } -func (x *IBCPacket) slowProtoReflect() protoreflect.Message { +func (x *TunnelPricesPacketData) slowProtoReflect() protoreflect.Message { mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1815,43 +1815,43 @@ func (x *IBCPacket) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_IBCPacket_messageType fastReflection_IBCPacket_messageType -var _ protoreflect.MessageType = fastReflection_IBCPacket_messageType{} +var _fastReflection_TunnelPricesPacketData_messageType fastReflection_TunnelPricesPacketData_messageType +var _ protoreflect.MessageType = fastReflection_TunnelPricesPacketData_messageType{} -type fastReflection_IBCPacket_messageType struct{} +type fastReflection_TunnelPricesPacketData_messageType struct{} -func (x fastReflection_IBCPacket_messageType) Zero() protoreflect.Message { - return (*fastReflection_IBCPacket)(nil) +func (x fastReflection_TunnelPricesPacketData_messageType) Zero() protoreflect.Message { + return (*fastReflection_TunnelPricesPacketData)(nil) } -func (x fastReflection_IBCPacket_messageType) New() protoreflect.Message { - return new(fastReflection_IBCPacket) +func (x fastReflection_TunnelPricesPacketData_messageType) New() protoreflect.Message { + return new(fastReflection_TunnelPricesPacketData) } -func (x fastReflection_IBCPacket_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_IBCPacket +func (x fastReflection_TunnelPricesPacketData_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TunnelPricesPacketData } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_IBCPacket) Descriptor() protoreflect.MessageDescriptor { - return md_IBCPacket +func (x *fastReflection_TunnelPricesPacketData) Descriptor() protoreflect.MessageDescriptor { + return md_TunnelPricesPacketData } // 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_IBCPacket) Type() protoreflect.MessageType { - return _fastReflection_IBCPacket_messageType +func (x *fastReflection_TunnelPricesPacketData) Type() protoreflect.MessageType { + return _fastReflection_TunnelPricesPacketData_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_IBCPacket) New() protoreflect.Message { - return new(fastReflection_IBCPacket) +func (x *fastReflection_TunnelPricesPacketData) New() protoreflect.Message { + return new(fastReflection_TunnelPricesPacketData) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_IBCPacket) Interface() protoreflect.ProtoMessage { - return (*IBCPacket)(x) +func (x *fastReflection_TunnelPricesPacketData) Interface() protoreflect.ProtoMessage { + return (*TunnelPricesPacketData)(x) } // Range iterates over every populated field in an undefined order, @@ -1859,28 +1859,28 @@ func (x *fastReflection_IBCPacket) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_IBCPacket) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_TunnelPricesPacketData) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.TunnelId != uint64(0) { value := protoreflect.ValueOfUint64(x.TunnelId) - if !f(fd_IBCPacket_tunnel_id, value) { + if !f(fd_TunnelPricesPacketData_tunnel_id, value) { return } } if x.Sequence != uint64(0) { value := protoreflect.ValueOfUint64(x.Sequence) - if !f(fd_IBCPacket_sequence, value) { + if !f(fd_TunnelPricesPacketData_sequence, value) { return } } if len(x.Prices) != 0 { - value := protoreflect.ValueOfList(&_IBCPacket_3_list{list: &x.Prices}) - if !f(fd_IBCPacket_prices, value) { + value := protoreflect.ValueOfList(&_TunnelPricesPacketData_3_list{list: &x.Prices}) + if !f(fd_TunnelPricesPacketData_prices, value) { return } } if x.CreatedAt != int64(0) { value := protoreflect.ValueOfInt64(x.CreatedAt) - if !f(fd_IBCPacket_created_at, value) { + if !f(fd_TunnelPricesPacketData_created_at, value) { return } } @@ -1897,21 +1897,21 @@ func (x *fastReflection_IBCPacket) Range(f func(protoreflect.FieldDescriptor, pr // 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_IBCPacket) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_TunnelPricesPacketData) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "band.tunnel.v1beta1.IBCPacket.tunnel_id": + case "band.tunnel.v1beta1.TunnelPricesPacketData.tunnel_id": return x.TunnelId != uint64(0) - case "band.tunnel.v1beta1.IBCPacket.sequence": + case "band.tunnel.v1beta1.TunnelPricesPacketData.sequence": return x.Sequence != uint64(0) - case "band.tunnel.v1beta1.IBCPacket.prices": + case "band.tunnel.v1beta1.TunnelPricesPacketData.prices": return len(x.Prices) != 0 - case "band.tunnel.v1beta1.IBCPacket.created_at": + case "band.tunnel.v1beta1.TunnelPricesPacketData.created_at": return x.CreatedAt != int64(0) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCPacket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.TunnelPricesPacketData")) } - panic(fmt.Errorf("message band.tunnel.v1beta1.IBCPacket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message band.tunnel.v1beta1.TunnelPricesPacketData does not contain field %s", fd.FullName())) } } @@ -1921,21 +1921,21 @@ func (x *fastReflection_IBCPacket) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IBCPacket) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_TunnelPricesPacketData) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "band.tunnel.v1beta1.IBCPacket.tunnel_id": + case "band.tunnel.v1beta1.TunnelPricesPacketData.tunnel_id": x.TunnelId = uint64(0) - case "band.tunnel.v1beta1.IBCPacket.sequence": + case "band.tunnel.v1beta1.TunnelPricesPacketData.sequence": x.Sequence = uint64(0) - case "band.tunnel.v1beta1.IBCPacket.prices": + case "band.tunnel.v1beta1.TunnelPricesPacketData.prices": x.Prices = nil - case "band.tunnel.v1beta1.IBCPacket.created_at": + case "band.tunnel.v1beta1.TunnelPricesPacketData.created_at": x.CreatedAt = int64(0) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCPacket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.TunnelPricesPacketData")) } - panic(fmt.Errorf("message band.tunnel.v1beta1.IBCPacket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message band.tunnel.v1beta1.TunnelPricesPacketData does not contain field %s", fd.FullName())) } } @@ -1945,28 +1945,28 @@ func (x *fastReflection_IBCPacket) Clear(fd protoreflect.FieldDescriptor) { // 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_IBCPacket) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_TunnelPricesPacketData) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "band.tunnel.v1beta1.IBCPacket.tunnel_id": + case "band.tunnel.v1beta1.TunnelPricesPacketData.tunnel_id": value := x.TunnelId return protoreflect.ValueOfUint64(value) - case "band.tunnel.v1beta1.IBCPacket.sequence": + case "band.tunnel.v1beta1.TunnelPricesPacketData.sequence": value := x.Sequence return protoreflect.ValueOfUint64(value) - case "band.tunnel.v1beta1.IBCPacket.prices": + case "band.tunnel.v1beta1.TunnelPricesPacketData.prices": if len(x.Prices) == 0 { - return protoreflect.ValueOfList(&_IBCPacket_3_list{}) + return protoreflect.ValueOfList(&_TunnelPricesPacketData_3_list{}) } - listValue := &_IBCPacket_3_list{list: &x.Prices} + listValue := &_TunnelPricesPacketData_3_list{list: &x.Prices} return protoreflect.ValueOfList(listValue) - case "band.tunnel.v1beta1.IBCPacket.created_at": + case "band.tunnel.v1beta1.TunnelPricesPacketData.created_at": value := x.CreatedAt return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCPacket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.TunnelPricesPacketData")) } - panic(fmt.Errorf("message band.tunnel.v1beta1.IBCPacket does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message band.tunnel.v1beta1.TunnelPricesPacketData does not contain field %s", descriptor.FullName())) } } @@ -1980,23 +1980,23 @@ func (x *fastReflection_IBCPacket) Get(descriptor protoreflect.FieldDescriptor) // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IBCPacket) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_TunnelPricesPacketData) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "band.tunnel.v1beta1.IBCPacket.tunnel_id": + case "band.tunnel.v1beta1.TunnelPricesPacketData.tunnel_id": x.TunnelId = value.Uint() - case "band.tunnel.v1beta1.IBCPacket.sequence": + case "band.tunnel.v1beta1.TunnelPricesPacketData.sequence": x.Sequence = value.Uint() - case "band.tunnel.v1beta1.IBCPacket.prices": + case "band.tunnel.v1beta1.TunnelPricesPacketData.prices": lv := value.List() - clv := lv.(*_IBCPacket_3_list) + clv := lv.(*_TunnelPricesPacketData_3_list) x.Prices = *clv.list - case "band.tunnel.v1beta1.IBCPacket.created_at": + case "band.tunnel.v1beta1.TunnelPricesPacketData.created_at": x.CreatedAt = value.Int() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCPacket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.TunnelPricesPacketData")) } - panic(fmt.Errorf("message band.tunnel.v1beta1.IBCPacket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message band.tunnel.v1beta1.TunnelPricesPacketData does not contain field %s", fd.FullName())) } } @@ -2010,57 +2010,57 @@ func (x *fastReflection_IBCPacket) Set(fd protoreflect.FieldDescriptor, value pr // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IBCPacket) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_TunnelPricesPacketData) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "band.tunnel.v1beta1.IBCPacket.prices": + case "band.tunnel.v1beta1.TunnelPricesPacketData.prices": if x.Prices == nil { x.Prices = []*v1beta1.Price{} } - value := &_IBCPacket_3_list{list: &x.Prices} + value := &_TunnelPricesPacketData_3_list{list: &x.Prices} return protoreflect.ValueOfList(value) - case "band.tunnel.v1beta1.IBCPacket.tunnel_id": - panic(fmt.Errorf("field tunnel_id of message band.tunnel.v1beta1.IBCPacket is not mutable")) - case "band.tunnel.v1beta1.IBCPacket.sequence": - panic(fmt.Errorf("field sequence of message band.tunnel.v1beta1.IBCPacket is not mutable")) - case "band.tunnel.v1beta1.IBCPacket.created_at": - panic(fmt.Errorf("field created_at of message band.tunnel.v1beta1.IBCPacket is not mutable")) + case "band.tunnel.v1beta1.TunnelPricesPacketData.tunnel_id": + panic(fmt.Errorf("field tunnel_id of message band.tunnel.v1beta1.TunnelPricesPacketData is not mutable")) + case "band.tunnel.v1beta1.TunnelPricesPacketData.sequence": + panic(fmt.Errorf("field sequence of message band.tunnel.v1beta1.TunnelPricesPacketData is not mutable")) + case "band.tunnel.v1beta1.TunnelPricesPacketData.created_at": + panic(fmt.Errorf("field created_at of message band.tunnel.v1beta1.TunnelPricesPacketData is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCPacket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.TunnelPricesPacketData")) } - panic(fmt.Errorf("message band.tunnel.v1beta1.IBCPacket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message band.tunnel.v1beta1.TunnelPricesPacketData 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_IBCPacket) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_TunnelPricesPacketData) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "band.tunnel.v1beta1.IBCPacket.tunnel_id": + case "band.tunnel.v1beta1.TunnelPricesPacketData.tunnel_id": return protoreflect.ValueOfUint64(uint64(0)) - case "band.tunnel.v1beta1.IBCPacket.sequence": + case "band.tunnel.v1beta1.TunnelPricesPacketData.sequence": return protoreflect.ValueOfUint64(uint64(0)) - case "band.tunnel.v1beta1.IBCPacket.prices": + case "band.tunnel.v1beta1.TunnelPricesPacketData.prices": list := []*v1beta1.Price{} - return protoreflect.ValueOfList(&_IBCPacket_3_list{list: &list}) - case "band.tunnel.v1beta1.IBCPacket.created_at": + return protoreflect.ValueOfList(&_TunnelPricesPacketData_3_list{list: &list}) + case "band.tunnel.v1beta1.TunnelPricesPacketData.created_at": return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.IBCPacket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.TunnelPricesPacketData")) } - panic(fmt.Errorf("message band.tunnel.v1beta1.IBCPacket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message band.tunnel.v1beta1.TunnelPricesPacketData 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_IBCPacket) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_TunnelPricesPacketData) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.IBCPacket", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in band.tunnel.v1beta1.TunnelPricesPacketData", d.FullName())) } panic("unreachable") } @@ -2068,7 +2068,7 @@ func (x *fastReflection_IBCPacket) WhichOneof(d protoreflect.OneofDescriptor) pr // 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_IBCPacket) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_TunnelPricesPacketData) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2079,7 +2079,7 @@ func (x *fastReflection_IBCPacket) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IBCPacket) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_TunnelPricesPacketData) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2091,7 +2091,7 @@ func (x *fastReflection_IBCPacket) SetUnknown(fields protoreflect.RawFields) { // 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_IBCPacket) IsValid() bool { +func (x *fastReflection_TunnelPricesPacketData) IsValid() bool { return x != nil } @@ -2101,9 +2101,9 @@ func (x *fastReflection_IBCPacket) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_IBCPacket) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_TunnelPricesPacketData) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*IBCPacket) + x := input.Message.Interface().(*TunnelPricesPacketData) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2140,7 +2140,7 @@ func (x *fastReflection_IBCPacket) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*IBCPacket) + x := input.Message.Interface().(*TunnelPricesPacketData) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2201,7 +2201,7 @@ func (x *fastReflection_IBCPacket) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*IBCPacket) + x := input.Message.Interface().(*TunnelPricesPacketData) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2233,10 +2233,10 @@ func (x *fastReflection_IBCPacket) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCPacket: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TunnelPricesPacketData: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IBCPacket: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TunnelPricesPacketData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3423,8 +3423,8 @@ func (x *IBCPacketReceipt) GetSequence() uint64 { return 0 } -// IBCPacket is the type for an IBC packet -type IBCPacket struct { +// TunnelPricesPacketData represents the IBC packet payload for the tunnel packet. +type TunnelPricesPacketData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -3439,8 +3439,8 @@ type IBCPacket struct { CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` } -func (x *IBCPacket) Reset() { - *x = IBCPacket{} +func (x *TunnelPricesPacketData) Reset() { + *x = TunnelPricesPacketData{} if protoimpl.UnsafeEnabled { mi := &file_band_tunnel_v1beta1_route_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3448,39 +3448,39 @@ func (x *IBCPacket) Reset() { } } -func (x *IBCPacket) String() string { +func (x *TunnelPricesPacketData) String() string { return protoimpl.X.MessageStringOf(x) } -func (*IBCPacket) ProtoMessage() {} +func (*TunnelPricesPacketData) ProtoMessage() {} -// Deprecated: Use IBCPacket.ProtoReflect.Descriptor instead. -func (*IBCPacket) Descriptor() ([]byte, []int) { +// Deprecated: Use TunnelPricesPacketData.ProtoReflect.Descriptor instead. +func (*TunnelPricesPacketData) Descriptor() ([]byte, []int) { return file_band_tunnel_v1beta1_route_proto_rawDescGZIP(), []int{4} } -func (x *IBCPacket) GetTunnelId() uint64 { +func (x *TunnelPricesPacketData) GetTunnelId() uint64 { if x != nil { return x.TunnelId } return 0 } -func (x *IBCPacket) GetSequence() uint64 { +func (x *TunnelPricesPacketData) GetSequence() uint64 { if x != nil { return x.Sequence } return 0 } -func (x *IBCPacket) GetPrices() []*v1beta1.Price { +func (x *TunnelPricesPacketData) GetPrices() []*v1beta1.Price { if x != nil { return x.Prices } return nil } -func (x *IBCPacket) GetCreatedAt() int64 { +func (x *TunnelPricesPacketData) GetCreatedAt() int64 { if x != nil { return x.CreatedAt } @@ -3609,46 +3609,47 @@ var file_band_tunnel_v1beta1_route_proto_rawDesc = []byte{ 0x6b, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x3a, 0x12, 0xca, 0xb4, 0x2d, 0x0e, 0x50, 0x61, 0x63, 0x6b, - 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x22, 0xaa, 0x01, 0x0a, 0x09, 0x49, - 0x42, 0x43, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x29, 0x0a, 0x09, 0x74, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0c, 0xe2, 0xde, 0x1f, - 0x08, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x37, 0x0a, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x06, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0c, 0x49, 0x42, 0x43, 0x48, - 0x6f, 0x6f, 0x6b, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xe2, 0xde, - 0x1f, 0x09, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0x52, 0x09, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x1c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1a, 0x64, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x09, 0xca, 0xb4, 0x2d, 0x05, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x22, 0x46, 0x0a, 0x14, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x61, - 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x3a, 0x12, 0xca, 0xb4, 0x2d, 0x0e, 0x50, 0x61, 0x63, - 0x6b, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x42, 0xdf, 0x01, 0x0a, 0x17, - 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x62, 0x61, 0x6e, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, 0x61, 0x6e, 0x64, - 0x2f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, - 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, - 0x42, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x42, 0x61, 0x6e, 0x64, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x42, 0x61, 0x6e, 0x64, - 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, - 0x02, 0x1f, 0x42, 0x61, 0x6e, 0x64, 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5c, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x15, 0x42, 0x61, 0x6e, 0x64, 0x3a, 0x3a, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x22, 0xb7, 0x01, 0x0a, 0x16, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0c, 0xe2, 0xde, 0x1f, 0x08, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x06, + 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62, + 0x61, 0x6e, 0x64, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0c, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, + 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xe2, 0xde, 0x1f, 0x09, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x1c, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1a, 0x64, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x09, 0xca, 0xb4, 0x2d, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x22, 0x46, 0x0a, 0x14, 0x49, 0x42, 0x43, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x3a, 0x12, 0xca, 0xb4, 0x2d, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x49, 0x42, 0xdf, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x61, 0x6e, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x2f, 0x76, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, 0x61, 0x6e, 0x64, 0x2f, 0x74, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x42, 0x54, 0x58, + 0xaa, 0x02, 0x13, 0x42, 0x61, 0x6e, 0x64, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x42, 0x61, 0x6e, 0x64, 0x5c, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x42, + 0x61, 0x6e, 0x64, 0x5c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x15, 0x42, 0x61, 0x6e, 0x64, 0x3a, 0x3a, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -3665,17 +3666,17 @@ func file_band_tunnel_v1beta1_route_proto_rawDescGZIP() []byte { var file_band_tunnel_v1beta1_route_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_band_tunnel_v1beta1_route_proto_goTypes = []interface{}{ - (*TSSRoute)(nil), // 0: band.tunnel.v1beta1.TSSRoute - (*TSSPacketReceipt)(nil), // 1: band.tunnel.v1beta1.TSSPacketReceipt - (*IBCRoute)(nil), // 2: band.tunnel.v1beta1.IBCRoute - (*IBCPacketReceipt)(nil), // 3: band.tunnel.v1beta1.IBCPacketReceipt - (*IBCPacket)(nil), // 4: band.tunnel.v1beta1.IBCPacket - (*IBCHookRoute)(nil), // 5: band.tunnel.v1beta1.IBCHookRoute - (*IBCHookPacketReceipt)(nil), // 6: band.tunnel.v1beta1.IBCHookPacketReceipt - (*v1beta1.Price)(nil), // 7: band.feeds.v1beta1.Price + (*TSSRoute)(nil), // 0: band.tunnel.v1beta1.TSSRoute + (*TSSPacketReceipt)(nil), // 1: band.tunnel.v1beta1.TSSPacketReceipt + (*IBCRoute)(nil), // 2: band.tunnel.v1beta1.IBCRoute + (*IBCPacketReceipt)(nil), // 3: band.tunnel.v1beta1.IBCPacketReceipt + (*TunnelPricesPacketData)(nil), // 4: band.tunnel.v1beta1.TunnelPricesPacketData + (*IBCHookRoute)(nil), // 5: band.tunnel.v1beta1.IBCHookRoute + (*IBCHookPacketReceipt)(nil), // 6: band.tunnel.v1beta1.IBCHookPacketReceipt + (*v1beta1.Price)(nil), // 7: band.feeds.v1beta1.Price } var file_band_tunnel_v1beta1_route_proto_depIdxs = []int32{ - 7, // 0: band.tunnel.v1beta1.IBCPacket.prices:type_name -> band.feeds.v1beta1.Price + 7, // 0: band.tunnel.v1beta1.TunnelPricesPacketData.prices:type_name -> band.feeds.v1beta1.Price 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -3738,7 +3739,7 @@ func file_band_tunnel_v1beta1_route_proto_init() { } } file_band_tunnel_v1beta1_route_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IBCPacket); i { + switch v := v.(*TunnelPricesPacketData); i { case 0: return &v.state case 1: diff --git a/proto/band/tunnel/v1beta1/route.proto b/proto/band/tunnel/v1beta1/route.proto index 62da299a1..da166d4de 100644 --- a/proto/band/tunnel/v1beta1/route.proto +++ b/proto/band/tunnel/v1beta1/route.proto @@ -46,8 +46,8 @@ message IBCPacketReceipt { uint64 sequence = 1; } -// IBCPacket is the type for an IBC packet -message IBCPacket { +// TunnelPricesPacketData represents the IBC packet payload for the tunnel packet. +message TunnelPricesPacketData { // tunnel_id is the tunnel ID uint64 tunnel_id = 1 [(gogoproto.customname) = "TunnelID"]; // sequence is representing the sequence of the tunnel packet. diff --git a/x/tunnel/ibc_module.go b/x/tunnel/ibc_module.go index abde07dc7..a3ce72660 100644 --- a/x/tunnel/ibc_module.go +++ b/x/tunnel/ibc_module.go @@ -1,6 +1,7 @@ package tunnel import ( + "math" "strings" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" @@ -18,6 +19,12 @@ import ( "github.com/bandprotocol/chain/v3/x/tunnel/types" ) +var ( + _ porttypes.IBCModule = (*IBCModule)(nil) + _ porttypes.PacketDataUnmarshaler = (*IBCModule)(nil) + _ porttypes.UpgradableModule = (*IBCModule)(nil) +) + // IBCModule implements the ICS26 interface for tunnel given the tunnel keeper. type IBCModule struct { keeper keeper.Keeper @@ -41,7 +48,7 @@ func (im IBCModule) OnChanOpenInit( counterparty channeltypes.Counterparty, version string, ) (string, error) { - err := validateChannelParams(ctx, im.keeper, order, portID) + err := ValidateTunnelChannelParams(ctx, im.keeper, order, portID, channelID) if err != nil { return "", err } @@ -74,7 +81,7 @@ func (im IBCModule) OnChanOpenTry( counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { - err := validateChannelParams(ctx, im.keeper, order, portID) + err := ValidateTunnelChannelParams(ctx, im.keeper, order, portID, channelID) if err != nil { return "", err } @@ -181,17 +188,100 @@ func (im IBCModule) OnTimeoutPacket( return nil } -// validateChannelParams validates the parameters of a newly created tunnel channel. -// A valid tunnel channel must be ORDERED, use the correct port (default is 'tunnel'). -func validateChannelParams( +// OnChanUpgradeInit implements the IBCModule interface +func (im IBCModule) OnChanUpgradeInit( + ctx sdk.Context, + portID, channelID string, + proposedOrder channeltypes.Order, + proposedConnectionHops []string, + proposedVersion string, +) (string, error) { + if err := ValidateTunnelChannelParams(ctx, im.keeper, proposedOrder, portID, channelID); err != nil { + return "", err + } + + if proposedVersion != types.Version { + return "", errorsmod.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, proposedVersion) + } + + return proposedVersion, nil +} + +// OnChanUpgradeTry implements the IBCModule interface +func (im IBCModule) OnChanUpgradeTry( + ctx sdk.Context, + portID, channelID string, + proposedOrder channeltypes.Order, + proposedConnectionHops []string, + counterpartyVersion string, +) (string, error) { + if err := ValidateTunnelChannelParams(ctx, im.keeper, proposedOrder, portID, channelID); err != nil { + return "", err + } + + if counterpartyVersion != types.Version { + return "", errorsmod.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, counterpartyVersion) + } + + return counterpartyVersion, nil +} + +// OnChanUpgradeAck implements the IBCModule interface +func (IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { + if counterpartyVersion != types.Version { + return errorsmod.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, counterpartyVersion) + } + + return nil +} + +// OnChanUpgradeOpen implements the IBCModule interface +func (IBCModule) OnChanUpgradeOpen( + ctx sdk.Context, + portID, channelID string, + proposedOrder channeltypes.Order, + proposedConnectionHops []string, + proposedVersion string, +) { +} + +// UnmarshalPacketData attempts to unmarshal the provided packet data bytes +// into a TunnelPricesPacketData. This function implements the optional +// PacketDataUnmarshaler interface required for ADR 008 support. +func (IBCModule) UnmarshalPacketData(bz []byte) (interface{}, error) { + var packetData types.TunnelPricesPacketData + if err := types.ModuleCdc.UnmarshalJSON(bz, &packetData); err != nil { + return nil, err + } + + return packetData, nil +} + +// ValidateTunnelChannelParams does validation of a newly created tunnel channel. A tunnel +// channel must be ORDERED, use the correct port (by default 'tunnel'), and use the current +// supported version. Only 2^32 channels are allowed to be created. +func ValidateTunnelChannelParams( ctx sdk.Context, keeper keeper.Keeper, order channeltypes.Order, portID string, + channelID string, ) error { + // NOTE: for escrow address security only 2^32 channels are allowed to be created + // Issue: https://github.com/cosmos/cosmos-sdk/issues/7737 + channelSequence, err := channeltypes.ParseChannelSequence(channelID) + if err != nil { + return err + } + if channelSequence > uint64(math.MaxUint32) { + return types.ErrMaxTunnelChannels.Wrapf( + "channel sequence %d is greater than max allowed tunnel channels %d", + channelSequence, + uint64(math.MaxUint32), + ) + } if order != channeltypes.ORDERED { - return errorsmod.Wrapf( - channeltypes.ErrInvalidChannelOrdering, + return channeltypes.ErrInvalidChannelOrdering.Wrapf( "expected %s channel, got %s", channeltypes.ORDERED, order, diff --git a/x/tunnel/ibc_module_test.go b/x/tunnel/ibc_module_test.go new file mode 100644 index 000000000..4629de174 --- /dev/null +++ b/x/tunnel/ibc_module_test.go @@ -0,0 +1,63 @@ +package tunnel_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + feedstypes "github.com/bandprotocol/chain/v3/x/feeds/types" + "github.com/bandprotocol/chain/v3/x/tunnel" + "github.com/bandprotocol/chain/v3/x/tunnel/types" +) + +func TestPacketDataUnmarshalerInterface(t *testing.T) { + var ( + data []byte + expPacketData types.TunnelPricesPacketData + ) + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + { + "invalid packet data", + func() { + data = []byte("invalid packet data") + }, + false, + }, + { + "all good", + func() { + expPacketData = types.TunnelPricesPacketData{ + TunnelID: 1, + Sequence: 1, + Prices: []feedstypes.Price{ + {Status: feedstypes.PRICE_STATUS_NOT_IN_CURRENT_FEEDS, SignalID: "BTC", Price: 50000}, + }, + CreatedAt: 1633024800, + } + data = expPacketData.GetBytes() + }, + true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tc.malleate() + + packetData, err := tunnel.IBCModule{}.UnmarshalPacketData(data) + + if tc.expPass { + require.NoError(t, err) + require.Equal(t, expPacketData, packetData) + } else { + require.Error(t, err) + require.Nil(t, packetData) + } + }) + } +} diff --git a/x/tunnel/keeper/keeper_packet_ibc.go b/x/tunnel/keeper/keeper_packet_ibc.go index 630cd644b..74ca63e17 100644 --- a/x/tunnel/keeper/keeper_packet_ibc.go +++ b/x/tunnel/keeper/keeper_packet_ibc.go @@ -27,8 +27,8 @@ func (k Keeper) SendIBCPacket( return nil, types.ErrChannelCapabilityNotFound } - // create the IBC packet bytes - packetBytes := types.NewIBCPacket( + // create the tunnel prices packet data bytes + packetBytes := types.NewTunnelPricesPacketData( packet.TunnelID, packet.Sequence, packet.Prices, @@ -49,5 +49,5 @@ func (k Keeper) SendIBCPacket( return nil, err } - return types.NewIBCPacketReceipt(route.ChannelID, sequence), nil + return types.NewIBCPacketReceipt(sequence), nil } diff --git a/x/tunnel/types/errors.go b/x/tunnel/types/errors.go index 6074a4dd2..d3c9ccb6f 100644 --- a/x/tunnel/types/errors.go +++ b/x/tunnel/types/errors.go @@ -27,4 +27,5 @@ var ( ErrDeviationNotFound = errorsmod.Register(ModuleName, 20, "deviation not found") ErrInvalidVersion = errorsmod.Register(ModuleName, 21, "invalid ICS20 version") ErrChannelCapabilityNotFound = errorsmod.Register(ModuleName, 22, "channel capability not found") + ErrMaxTunnelChannels = errorsmod.Register(ModuleName, 23, "max tunnel channels exceeded") ) diff --git a/x/tunnel/types/route.pb.go b/x/tunnel/types/route.pb.go index 6016ba241..b5a7ccd97 100644 --- a/x/tunnel/types/route.pb.go +++ b/x/tunnel/types/route.pb.go @@ -219,8 +219,8 @@ func (m *IBCPacketReceipt) GetSequence() uint64 { return 0 } -// IBCPacket is the type for an IBC packet -type IBCPacket struct { +// TunnelPricesPacketData represents the IBC packet payload for the tunnel packet. +type TunnelPricesPacketData struct { // tunnel_id is the tunnel ID TunnelID uint64 `protobuf:"varint,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` // sequence is representing the sequence of the tunnel packet. @@ -231,18 +231,18 @@ type IBCPacket struct { CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` } -func (m *IBCPacket) Reset() { *m = IBCPacket{} } -func (m *IBCPacket) String() string { return proto.CompactTextString(m) } -func (*IBCPacket) ProtoMessage() {} -func (*IBCPacket) Descriptor() ([]byte, []int) { +func (m *TunnelPricesPacketData) Reset() { *m = TunnelPricesPacketData{} } +func (m *TunnelPricesPacketData) String() string { return proto.CompactTextString(m) } +func (*TunnelPricesPacketData) ProtoMessage() {} +func (*TunnelPricesPacketData) Descriptor() ([]byte, []int) { return fileDescriptor_543238289d94b7a6, []int{4} } -func (m *IBCPacket) XXX_Unmarshal(b []byte) error { +func (m *TunnelPricesPacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *IBCPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *TunnelPricesPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_IBCPacket.Marshal(b, m, deterministic) + return xxx_messageInfo_TunnelPricesPacketData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -252,40 +252,40 @@ func (m *IBCPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *IBCPacket) XXX_Merge(src proto.Message) { - xxx_messageInfo_IBCPacket.Merge(m, src) +func (m *TunnelPricesPacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_TunnelPricesPacketData.Merge(m, src) } -func (m *IBCPacket) XXX_Size() int { +func (m *TunnelPricesPacketData) XXX_Size() int { return m.Size() } -func (m *IBCPacket) XXX_DiscardUnknown() { - xxx_messageInfo_IBCPacket.DiscardUnknown(m) +func (m *TunnelPricesPacketData) XXX_DiscardUnknown() { + xxx_messageInfo_TunnelPricesPacketData.DiscardUnknown(m) } -var xxx_messageInfo_IBCPacket proto.InternalMessageInfo +var xxx_messageInfo_TunnelPricesPacketData proto.InternalMessageInfo -func (m *IBCPacket) GetTunnelID() uint64 { +func (m *TunnelPricesPacketData) GetTunnelID() uint64 { if m != nil { return m.TunnelID } return 0 } -func (m *IBCPacket) GetSequence() uint64 { +func (m *TunnelPricesPacketData) GetSequence() uint64 { if m != nil { return m.Sequence } return 0 } -func (m *IBCPacket) GetPrices() []types.Price { +func (m *TunnelPricesPacketData) GetPrices() []types.Price { if m != nil { return m.Prices } return nil } -func (m *IBCPacket) GetCreatedAt() int64 { +func (m *TunnelPricesPacketData) GetCreatedAt() int64 { if m != nil { return m.CreatedAt } @@ -398,7 +398,7 @@ func init() { proto.RegisterType((*TSSPacketReceipt)(nil), "band.tunnel.v1beta1.TSSPacketReceipt") proto.RegisterType((*IBCRoute)(nil), "band.tunnel.v1beta1.IBCRoute") proto.RegisterType((*IBCPacketReceipt)(nil), "band.tunnel.v1beta1.IBCPacketReceipt") - proto.RegisterType((*IBCPacket)(nil), "band.tunnel.v1beta1.IBCPacket") + proto.RegisterType((*TunnelPricesPacketData)(nil), "band.tunnel.v1beta1.TunnelPricesPacketData") proto.RegisterType((*IBCHookRoute)(nil), "band.tunnel.v1beta1.IBCHookRoute") proto.RegisterType((*IBCHookPacketReceipt)(nil), "band.tunnel.v1beta1.IBCHookPacketReceipt") } @@ -406,41 +406,42 @@ func init() { func init() { proto.RegisterFile("band/tunnel/v1beta1/route.proto", fileDescriptor_543238289d94b7a6) } var fileDescriptor_543238289d94b7a6 = []byte{ - // 543 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0x9b, 0x10, 0xc5, 0x43, 0x41, 0x95, 0x89, 0x50, 0x1a, 0x81, 0x1d, 0x79, 0x15, 0x24, - 0x62, 0xab, 0x74, 0x81, 0x94, 0x15, 0xb5, 0x23, 0xd4, 0x11, 0x42, 0xaa, 0x9c, 0xac, 0xd8, 0x44, - 0xce, 0xcc, 0x90, 0x98, 0xb6, 0x33, 0xc1, 0x33, 0xa9, 0xe0, 0x13, 0xd8, 0x21, 0x3e, 0x81, 0x15, - 0x62, 0x9d, 0x8f, 0xa8, 0xb2, 0xea, 0x92, 0x55, 0x84, 0x9c, 0xbf, 0x60, 0x85, 0xe6, 0x41, 0x1e, - 0xac, 0x10, 0xb0, 0xf3, 0x9c, 0x7b, 0xe6, 0xde, 0x73, 0xcf, 0x1c, 0x19, 0x78, 0xa3, 0x94, 0xe2, - 0x50, 0xcc, 0x28, 0x25, 0x17, 0xe1, 0xd5, 0xd1, 0x88, 0x88, 0xf4, 0x28, 0xcc, 0xd9, 0x4c, 0x90, - 0x60, 0x9a, 0x33, 0xc1, 0x9c, 0x7b, 0x92, 0x10, 0x68, 0x42, 0x60, 0x08, 0xcd, 0x43, 0xc4, 0xf8, - 0x25, 0xe3, 0x43, 0x45, 0x09, 0xf5, 0x41, 0xf3, 0x9b, 0xf5, 0x31, 0x1b, 0x33, 0x8d, 0xcb, 0x2f, - 0x83, 0xba, 0x6a, 0xcc, 0x6b, 0x42, 0x30, 0x5f, 0x4f, 0x51, 0x27, 0x5d, 0xf7, 0x3f, 0x5b, 0xa0, - 0x36, 0xe8, 0xf7, 0x13, 0x39, 0xd8, 0x39, 0x05, 0x75, 0x4c, 0xb8, 0xc8, 0x68, 0x2a, 0x32, 0x46, - 0x87, 0x68, 0x92, 0x66, 0x74, 0x98, 0xe1, 0x86, 0xd5, 0xb2, 0xda, 0x76, 0x74, 0xbf, 0x58, 0x7a, - 0x4e, 0x6f, 0x53, 0x8f, 0x65, 0x19, 0xf6, 0x12, 0x07, 0xff, 0x8e, 0x61, 0xe7, 0x19, 0x78, 0xb0, - 0xd3, 0x89, 0x51, 0x91, 0xa7, 0x48, 0x0c, 0x53, 0x8c, 0x73, 0xc2, 0x79, 0x63, 0x4f, 0x76, 0x4c, - 0x9a, 0xdb, 0x37, 0x0d, 0xe5, 0x44, 0x33, 0xba, 0x60, 0x31, 0xef, 0x54, 0x95, 0x2c, 0xe8, 0x7f, - 0xb2, 0xc0, 0xc1, 0xa0, 0xdf, 0x3f, 0x4b, 0xd1, 0x39, 0x11, 0x09, 0x41, 0x24, 0x9b, 0x0a, 0xe7, - 0x0d, 0x00, 0x3c, 0x1b, 0xd3, 0x8c, 0x8e, 0x7f, 0x49, 0xac, 0x44, 0x2f, 0x8a, 0xa5, 0x67, 0xf7, - 0x35, 0x0a, 0x7b, 0x3f, 0x96, 0x5e, 0x77, 0x9c, 0x89, 0xc9, 0x6c, 0x14, 0x20, 0x76, 0x19, 0x4a, - 0x27, 0xd4, 0xd2, 0x88, 0x5d, 0x84, 0x6a, 0xb7, 0xf0, 0xea, 0x38, 0x7c, 0xa7, 0x70, 0xc1, 0x79, - 0x28, 0xde, 0x4f, 0x09, 0x0f, 0xd6, 0xb7, 0x13, 0xdb, 0xb4, 0x87, 0xb8, 0xeb, 0x2c, 0xe6, 0x9d, - 0xbb, 0x3b, 0xe3, 0xa1, 0x1f, 0x83, 0x1a, 0x8c, 0x62, 0x6d, 0xdc, 0x63, 0x00, 0xd0, 0x24, 0x95, - 0x2f, 0xb5, 0xb1, 0xeb, 0x8e, 0xd4, 0x12, 0x6b, 0x54, 0x76, 0x33, 0x04, 0x88, 0xbb, 0xf6, 0x62, - 0xde, 0xb9, 0xa5, 0x2e, 0xfa, 0x11, 0x38, 0x80, 0x51, 0xbc, 0xbb, 0x58, 0x13, 0xd4, 0x38, 0x79, - 0x3b, 0x23, 0x14, 0x11, 0xbd, 0x56, 0xb2, 0x3e, 0x6f, 0x0b, 0x91, 0x86, 0x11, 0x2a, 0xa0, 0xff, - 0xd5, 0x02, 0xf6, 0xba, 0x89, 0xf3, 0x08, 0xd8, 0x3a, 0x33, 0x1b, 0x57, 0xf6, 0x8b, 0xa5, 0x57, - 0x1b, 0xcc, 0x8c, 0x90, 0x9a, 0x2e, 0x43, 0xbc, 0x33, 0x68, 0x6f, 0x77, 0x90, 0xf3, 0x14, 0x54, - 0xa7, 0x79, 0x86, 0x08, 0x6f, 0x94, 0x5b, 0xe5, 0xf6, 0xed, 0x27, 0x87, 0x81, 0x8a, 0xa3, 0x8e, - 0x8e, 0x09, 0x52, 0x70, 0x26, 0x19, 0x51, 0xe5, 0x7a, 0xe9, 0x95, 0x12, 0x43, 0x77, 0x1e, 0x02, - 0x80, 0x72, 0x92, 0x0a, 0x82, 0x87, 0xa9, 0x68, 0x54, 0x5a, 0x56, 0xbb, 0x9c, 0xd8, 0x06, 0x39, - 0x11, 0xfe, 0x07, 0x0b, 0xec, 0xc3, 0x28, 0x3e, 0x65, 0xec, 0xfc, 0x2f, 0xac, 0xfb, 0x0f, 0xb9, - 0xda, 0x32, 0xff, 0x39, 0xa8, 0x1b, 0x29, 0xff, 0xf4, 0x00, 0xd1, 0xcb, 0x2f, 0x85, 0x6b, 0x5d, - 0x17, 0xae, 0x75, 0x53, 0xb8, 0xd6, 0xf7, 0xc2, 0xb5, 0x3e, 0xae, 0xdc, 0xd2, 0xcd, 0xca, 0x2d, - 0x7d, 0x5b, 0xb9, 0xa5, 0x57, 0xe1, 0x1f, 0x44, 0xd0, 0xfc, 0x06, 0x54, 0x02, 0x47, 0x55, 0xc5, - 0x38, 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0x79, 0x34, 0x5f, 0x42, 0x22, 0x04, 0x00, 0x00, + // 554 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xcd, 0x34, 0xf9, 0xa2, 0x78, 0xbe, 0x82, 0x2a, 0x13, 0x55, 0x69, 0x04, 0x76, 0xe4, 0x55, + 0x90, 0x88, 0xad, 0xd2, 0x05, 0x52, 0x56, 0xd4, 0x8e, 0x50, 0x47, 0x08, 0xa9, 0x72, 0xb2, 0x62, + 0x13, 0x4d, 0x66, 0x86, 0xc4, 0xb4, 0x9d, 0x09, 0x9e, 0x49, 0x05, 0x8f, 0xc0, 0x0e, 0xf1, 0x08, + 0xac, 0x78, 0x80, 0x48, 0xbc, 0x42, 0x95, 0x55, 0x97, 0xac, 0x22, 0xe4, 0xbc, 0x05, 0x2b, 0xe4, + 0x19, 0x93, 0x1f, 0x56, 0x08, 0xd8, 0x79, 0xce, 0x3d, 0x73, 0xcf, 0xbd, 0x67, 0x8e, 0x0c, 0xdd, + 0x11, 0xe6, 0x34, 0x50, 0x33, 0xce, 0xd9, 0x65, 0x70, 0x7d, 0x3c, 0x62, 0x0a, 0x1f, 0x07, 0xa9, + 0x98, 0x29, 0xe6, 0x4f, 0x53, 0xa1, 0x84, 0x7d, 0x2f, 0x27, 0xf8, 0x86, 0xe0, 0x17, 0x84, 0xe6, + 0x11, 0x11, 0xf2, 0x4a, 0xc8, 0xa1, 0xa6, 0x04, 0xe6, 0x60, 0xf8, 0xcd, 0xfa, 0x58, 0x8c, 0x85, + 0xc1, 0xf3, 0xaf, 0x02, 0x75, 0xb4, 0xcc, 0x2b, 0xc6, 0xa8, 0x5c, 0xab, 0xe8, 0x93, 0xa9, 0x7b, + 0x9f, 0x00, 0xac, 0x0d, 0xfa, 0xfd, 0x38, 0x17, 0xb6, 0xcf, 0x60, 0x9d, 0x32, 0xa9, 0x12, 0x8e, + 0x55, 0x22, 0xf8, 0x90, 0x4c, 0x70, 0xc2, 0x87, 0x09, 0x6d, 0x80, 0x16, 0x68, 0x5b, 0xe1, 0x61, + 0xb6, 0x74, 0xed, 0xde, 0xa6, 0x1e, 0xe5, 0x65, 0xd4, 0x8b, 0x6d, 0xfa, 0x2b, 0x46, 0xed, 0xa7, + 0xf0, 0xfe, 0x4e, 0x27, 0xc1, 0x55, 0x8a, 0x89, 0x1a, 0x62, 0x4a, 0x53, 0x26, 0x65, 0x63, 0x2f, + 0xef, 0x18, 0x37, 0xb7, 0x6f, 0x16, 0x94, 0x53, 0xc3, 0xe8, 0xc2, 0xc5, 0xbc, 0x53, 0xd5, 0x63, + 0x21, 0xef, 0x23, 0x80, 0x07, 0x83, 0x7e, 0xff, 0x1c, 0x93, 0x0b, 0xa6, 0x62, 0x46, 0x58, 0x32, + 0x55, 0xf6, 0x6b, 0x08, 0x65, 0x32, 0xe6, 0x09, 0x1f, 0xff, 0x1c, 0xb1, 0x12, 0x3e, 0xcf, 0x96, + 0xae, 0xd5, 0x37, 0x28, 0xea, 0x7d, 0x5f, 0xba, 0xdd, 0x71, 0xa2, 0x26, 0xb3, 0x91, 0x4f, 0xc4, + 0x55, 0x90, 0x3b, 0xa1, 0x97, 0x26, 0xe2, 0x32, 0xd0, 0xbb, 0x05, 0xd7, 0x27, 0xc1, 0x5b, 0x8d, + 0x2b, 0x29, 0x03, 0xf5, 0x6e, 0xca, 0xa4, 0xbf, 0xbe, 0x1d, 0x5b, 0x45, 0x7b, 0x44, 0xbb, 0xf6, + 0x62, 0xde, 0xb9, 0xbb, 0x23, 0x8f, 0xbc, 0x08, 0xd6, 0x50, 0x18, 0x19, 0xe3, 0x1e, 0x41, 0x48, + 0x26, 0x38, 0x7f, 0xa9, 0x8d, 0x5d, 0x77, 0xf2, 0x59, 0x22, 0x83, 0xe6, 0xdd, 0x0a, 0x02, 0xa2, + 0x5d, 0x6b, 0x31, 0xef, 0xfc, 0xa7, 0x2f, 0x7a, 0x21, 0x3c, 0x40, 0x61, 0xb4, 0xbb, 0x58, 0x13, + 0xd6, 0x24, 0x7b, 0x33, 0x63, 0x9c, 0x30, 0xb3, 0x56, 0xbc, 0x3e, 0x6f, 0x0f, 0x92, 0x1b, 0xc6, + 0xb8, 0x42, 0xde, 0x17, 0x00, 0x0f, 0x07, 0x3a, 0x26, 0xe7, 0x69, 0x42, 0x98, 0x34, 0xe5, 0x1e, + 0x56, 0xd8, 0x7e, 0x08, 0x2d, 0x13, 0xa0, 0x8d, 0x45, 0xfb, 0xd9, 0xd2, 0xad, 0x19, 0x3a, 0xea, + 0xc5, 0x35, 0x53, 0x46, 0x74, 0x47, 0x75, 0x6f, 0x57, 0xd5, 0x7e, 0x02, 0xab, 0x53, 0xdd, 0xba, + 0x51, 0x6e, 0x95, 0xdb, 0xff, 0x3f, 0x3e, 0xf2, 0x75, 0x36, 0x4d, 0x8e, 0x8a, 0x54, 0xf9, 0x5a, + 0x3c, 0xac, 0xdc, 0x2c, 0xdd, 0x52, 0x5c, 0xd0, 0xed, 0x07, 0x10, 0x92, 0x94, 0x61, 0xc5, 0xe8, + 0x10, 0xab, 0x46, 0xa5, 0x05, 0xda, 0xe5, 0xd8, 0x2a, 0x90, 0x53, 0xe5, 0xbd, 0x07, 0x70, 0x1f, + 0x85, 0xd1, 0x99, 0x10, 0x17, 0x7f, 0xe0, 0xe3, 0x3f, 0x08, 0xd9, 0xd6, 0x4b, 0x3c, 0x83, 0xf5, + 0x62, 0x94, 0xbf, 0x7a, 0x8d, 0xf0, 0xc5, 0xe7, 0xcc, 0x01, 0x37, 0x99, 0x03, 0x6e, 0x33, 0x07, + 0x7c, 0xcb, 0x1c, 0xf0, 0x61, 0xe5, 0x94, 0x6e, 0x57, 0x4e, 0xe9, 0xeb, 0xca, 0x29, 0xbd, 0x0c, + 0x7e, 0x23, 0x8f, 0xc5, 0x3f, 0x41, 0xc7, 0x71, 0x54, 0xd5, 0x8c, 0x93, 0x1f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x69, 0xc4, 0xe6, 0x73, 0x2f, 0x04, 0x00, 0x00, } func (this *TSSRoute) Equal(that interface{}) bool { @@ -542,14 +543,14 @@ func (this *IBCPacketReceipt) Equal(that interface{}) bool { } return true } -func (this *IBCPacket) Equal(that interface{}) bool { +func (this *TunnelPricesPacketData) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*IBCPacket) + that1, ok := that.(*TunnelPricesPacketData) if !ok { - that2, ok := that.(IBCPacket) + that2, ok := that.(TunnelPricesPacketData) if ok { that1 = &that2 } else { @@ -754,7 +755,7 @@ func (m *IBCPacketReceipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *IBCPacket) Marshal() (dAtA []byte, err error) { +func (m *TunnelPricesPacketData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -764,12 +765,12 @@ func (m *IBCPacket) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *IBCPacket) MarshalTo(dAtA []byte) (int, error) { +func (m *TunnelPricesPacketData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *IBCPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TunnelPricesPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -936,7 +937,7 @@ func (m *IBCPacketReceipt) Size() (n int) { return n } -func (m *IBCPacket) Size() (n int) { +func (m *TunnelPricesPacketData) Size() (n int) { if m == nil { return 0 } @@ -1329,7 +1330,7 @@ func (m *IBCPacketReceipt) Unmarshal(dAtA []byte) error { } return nil } -func (m *IBCPacket) Unmarshal(dAtA []byte) error { +func (m *TunnelPricesPacketData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1352,10 +1353,10 @@ func (m *IBCPacket) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: IBCPacket: wiretype end group for non-group") + return fmt.Errorf("proto: TunnelPricesPacketData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: IBCPacket: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TunnelPricesPacketData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/tunnel/types/route_ibc.go b/x/tunnel/types/route_ibc.go index 94f9f4e96..f34c32f3d 100644 --- a/x/tunnel/types/route_ibc.go +++ b/x/tunnel/types/route_ibc.go @@ -2,7 +2,8 @@ package types import ( "fmt" - "regexp" + + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,10 +13,6 @@ import ( // IBCRoute defines the IBC route for the tunnel module var _ RouteI = &IBCRoute{} -// IsChannelIDFormat checks if a channelID is in the format required on the SDK for -// parsing channel identifiers. The channel identifier must be in the form: `channel-{N} -var IsChannelIDFormat = regexp.MustCompile(`^channel-[0-9]{1,20}$`).MatchString - // NewIBCRoute creates a new IBCRoute instance. func NewIBCRoute(channelID string) *IBCRoute { return &IBCRoute{ @@ -26,27 +23,27 @@ func NewIBCRoute(channelID string) *IBCRoute { // Route defines the IBC route for the tunnel module func (r *IBCRoute) ValidateBasic() error { // Validate the ChannelID format - if !IsChannelIDFormat(r.ChannelID) { + if !channeltypes.IsChannelIDFormat(r.ChannelID) { return fmt.Errorf("channel identifier is not in the format: `channel-{N}`") } return nil } // NewIBCPacketReceipt creates a new IBCPacketReceipt instance. -func NewIBCPacketReceipt(channelID string, sequence uint64) *IBCPacketReceipt { +func NewIBCPacketReceipt(sequence uint64) *IBCPacketReceipt { return &IBCPacketReceipt{ Sequence: sequence, } } -// NewIBCPacket creates a new IBCPacket instance. It is used to create the IBC packet data -func NewIBCPacket( +// NewTunnelPricesPacketData creates a new TunnelPricesPacketData instance. +func NewTunnelPricesPacketData( tunnelID uint64, sequence uint64, prices []feedstypes.Price, created_at int64, -) IBCPacket { - return IBCPacket{ +) TunnelPricesPacketData { + return TunnelPricesPacketData{ TunnelID: tunnelID, Sequence: sequence, Prices: prices, @@ -54,7 +51,7 @@ func NewIBCPacket( } } -// GetBytes returns the IBCPacketResult bytes -func (p IBCPacket) GetBytes() []byte { +// GetBytes is a helper for serialising +func (p TunnelPricesPacketData) GetBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&p)) } diff --git a/x/tunnel/types/route_ibc_hook.go b/x/tunnel/types/route_ibc_hook.go index 5665335c5..64d4a6eef 100644 --- a/x/tunnel/types/route_ibc_hook.go +++ b/x/tunnel/types/route_ibc_hook.go @@ -2,6 +2,8 @@ package types import ( "fmt" + + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) // IBCRoute defines the IBC route for the tunnel module @@ -18,7 +20,7 @@ func NewIBCHookRoute(channelID, destinationContractAddress string) *IBCHookRoute // Route defines the IBC route for the tunnel module func (r *IBCHookRoute) ValidateBasic() error { // Validate the ChannelID format - if !IsChannelIDFormat(r.ChannelID) { + if !channeltypes.IsChannelIDFormat(r.ChannelID) { return fmt.Errorf("channel identifier is not in the format: `channel-{N}`") } return nil diff --git a/x/tunnel/types/route_ibc_test.go b/x/tunnel/types/route_ibc_test.go index 3f5ad181a..26b91d30f 100644 --- a/x/tunnel/types/route_ibc_test.go +++ b/x/tunnel/types/route_ibc_test.go @@ -9,18 +9,18 @@ import ( "github.com/bandprotocol/chain/v3/x/tunnel/types" ) -func TestGetByteIBCPacket(t *testing.T) { - packet := types.NewIBCPacket( +func TestGetByteTunnelPricesPacketData(t *testing.T) { + packet := types.NewTunnelPricesPacketData( 1, - 1, - []feedstypes.Price{{SignalID: "BTC", Price: 1000}}, - 0, + 2, + []feedstypes.Price{{Status: feedstypes.PRICE_STATUS_NOT_IN_CURRENT_FEEDS, SignalID: "BTC", Price: 50000}}, + 1633024800, ) require.Equal( t, []byte( - `{"created_at":"0","prices":[{"price":"1000","signal_id":"BTC","status":"PRICE_STATUS_UNSPECIFIED","timestamp":"0"}],"sequence":"1","tunnel_id":"1"}`, + `{"created_at":"1633024800","prices":[{"price":"50000","signal_id":"BTC","status":"PRICE_STATUS_NOT_IN_CURRENT_FEEDS","timestamp":"0"}],"sequence":"2","tunnel_id":"1"}`, ), packet.GetBytes(), )