From 8556dec02d1414d7a0ac8341cb6cd931c5c604cd Mon Sep 17 00:00:00 2001 From: satawatnack Date: Mon, 18 Nov 2024 15:55:08 +0700 Subject: [PATCH 1/5] add max min interval deviation --- api/band/tunnel/v1beta1/params.pulsar.go | 284 +++++++++++++++++++---- proto/band/tunnel/v1beta1/params.proto | 10 +- x/tunnel/keeper/msg_server.go | 35 ++- x/tunnel/keeper/msg_server_test.go | 69 +++++- x/tunnel/types/errors.go | 33 +-- x/tunnel/types/params.go | 59 ++++- x/tunnel/types/params.pb.go | 173 +++++++++++--- x/tunnel/types/params_test.go | 47 ++++ x/tunnel/types/signal.go | 25 ++ 9 files changed, 611 insertions(+), 124 deletions(-) diff --git a/api/band/tunnel/v1beta1/params.pulsar.go b/api/band/tunnel/v1beta1/params.pulsar.go index a861c3785..170fc8db1 100644 --- a/api/band/tunnel/v1beta1/params.pulsar.go +++ b/api/band/tunnel/v1beta1/params.pulsar.go @@ -65,63 +65,66 @@ func (x *_Params_1_list) IsValid() bool { return x.list != nil } -var _ protoreflect.List = (*_Params_4_list)(nil) +var _ protoreflect.List = (*_Params_7_list)(nil) -type _Params_4_list struct { +type _Params_7_list struct { list *[]*v1beta1.Coin } -func (x *_Params_4_list) Len() int { +func (x *_Params_7_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_Params_4_list) Get(i int) protoreflect.Value { +func (x *_Params_7_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_Params_4_list) Set(i int, value protoreflect.Value) { +func (x *_Params_7_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) (*x.list)[i] = concreteValue } -func (x *_Params_4_list) Append(value protoreflect.Value) { +func (x *_Params_7_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) *x.list = append(*x.list, concreteValue) } -func (x *_Params_4_list) AppendMutable() protoreflect.Value { +func (x *_Params_7_list) AppendMutable() protoreflect.Value { v := new(v1beta1.Coin) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_Params_4_list) Truncate(n int) { +func (x *_Params_7_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_Params_4_list) NewElement() protoreflect.Value { +func (x *_Params_7_list) NewElement() protoreflect.Value { v := new(v1beta1.Coin) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_Params_4_list) IsValid() bool { +func (x *_Params_7_list) IsValid() bool { return x.list != nil } var ( - md_Params protoreflect.MessageDescriptor - fd_Params_min_deposit protoreflect.FieldDescriptor - fd_Params_min_interval protoreflect.FieldDescriptor - fd_Params_max_signals protoreflect.FieldDescriptor - fd_Params_base_packet_fee protoreflect.FieldDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_min_deposit protoreflect.FieldDescriptor + fd_Params_min_interval protoreflect.FieldDescriptor + fd_Params_max_interval protoreflect.FieldDescriptor + fd_Params_min_deviation_bps protoreflect.FieldDescriptor + fd_Params_max_deviation_bps protoreflect.FieldDescriptor + fd_Params_max_signals protoreflect.FieldDescriptor + fd_Params_base_packet_fee protoreflect.FieldDescriptor ) func init() { @@ -129,6 +132,9 @@ func init() { md_Params = File_band_tunnel_v1beta1_params_proto.Messages().ByName("Params") fd_Params_min_deposit = md_Params.Fields().ByName("min_deposit") fd_Params_min_interval = md_Params.Fields().ByName("min_interval") + fd_Params_max_interval = md_Params.Fields().ByName("max_interval") + fd_Params_min_deviation_bps = md_Params.Fields().ByName("min_deviation_bps") + fd_Params_max_deviation_bps = md_Params.Fields().ByName("max_deviation_bps") fd_Params_max_signals = md_Params.Fields().ByName("max_signals") fd_Params_base_packet_fee = md_Params.Fields().ByName("base_packet_fee") } @@ -210,6 +216,24 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.MaxInterval != uint64(0) { + value := protoreflect.ValueOfUint64(x.MaxInterval) + if !f(fd_Params_max_interval, value) { + return + } + } + if x.MinDeviationBps != uint64(0) { + value := protoreflect.ValueOfUint64(x.MinDeviationBps) + if !f(fd_Params_min_deviation_bps, value) { + return + } + } + if x.MaxDeviationBps != uint64(0) { + value := protoreflect.ValueOfUint64(x.MaxDeviationBps) + if !f(fd_Params_max_deviation_bps, value) { + return + } + } if x.MaxSignals != uint64(0) { value := protoreflect.ValueOfUint64(x.MaxSignals) if !f(fd_Params_max_signals, value) { @@ -217,7 +241,7 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto } } if len(x.BasePacketFee) != 0 { - value := protoreflect.ValueOfList(&_Params_4_list{list: &x.BasePacketFee}) + value := protoreflect.ValueOfList(&_Params_7_list{list: &x.BasePacketFee}) if !f(fd_Params_base_packet_fee, value) { return } @@ -241,6 +265,12 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return len(x.MinDeposit) != 0 case "band.tunnel.v1beta1.Params.min_interval": return x.MinInterval != uint64(0) + case "band.tunnel.v1beta1.Params.max_interval": + return x.MaxInterval != uint64(0) + case "band.tunnel.v1beta1.Params.min_deviation_bps": + return x.MinDeviationBps != uint64(0) + case "band.tunnel.v1beta1.Params.max_deviation_bps": + return x.MaxDeviationBps != uint64(0) case "band.tunnel.v1beta1.Params.max_signals": return x.MaxSignals != uint64(0) case "band.tunnel.v1beta1.Params.base_packet_fee": @@ -265,6 +295,12 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.MinDeposit = nil case "band.tunnel.v1beta1.Params.min_interval": x.MinInterval = uint64(0) + case "band.tunnel.v1beta1.Params.max_interval": + x.MaxInterval = uint64(0) + case "band.tunnel.v1beta1.Params.min_deviation_bps": + x.MinDeviationBps = uint64(0) + case "band.tunnel.v1beta1.Params.max_deviation_bps": + x.MaxDeviationBps = uint64(0) case "band.tunnel.v1beta1.Params.max_signals": x.MaxSignals = uint64(0) case "band.tunnel.v1beta1.Params.base_packet_fee": @@ -294,14 +330,23 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "band.tunnel.v1beta1.Params.min_interval": value := x.MinInterval return protoreflect.ValueOfUint64(value) + case "band.tunnel.v1beta1.Params.max_interval": + value := x.MaxInterval + return protoreflect.ValueOfUint64(value) + case "band.tunnel.v1beta1.Params.min_deviation_bps": + value := x.MinDeviationBps + return protoreflect.ValueOfUint64(value) + case "band.tunnel.v1beta1.Params.max_deviation_bps": + value := x.MaxDeviationBps + return protoreflect.ValueOfUint64(value) case "band.tunnel.v1beta1.Params.max_signals": value := x.MaxSignals return protoreflect.ValueOfUint64(value) case "band.tunnel.v1beta1.Params.base_packet_fee": if len(x.BasePacketFee) == 0 { - return protoreflect.ValueOfList(&_Params_4_list{}) + return protoreflect.ValueOfList(&_Params_7_list{}) } - listValue := &_Params_4_list{list: &x.BasePacketFee} + listValue := &_Params_7_list{list: &x.BasePacketFee} return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { @@ -329,11 +374,17 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.MinDeposit = *clv.list case "band.tunnel.v1beta1.Params.min_interval": x.MinInterval = value.Uint() + case "band.tunnel.v1beta1.Params.max_interval": + x.MaxInterval = value.Uint() + case "band.tunnel.v1beta1.Params.min_deviation_bps": + x.MinDeviationBps = value.Uint() + case "band.tunnel.v1beta1.Params.max_deviation_bps": + x.MaxDeviationBps = value.Uint() case "band.tunnel.v1beta1.Params.max_signals": x.MaxSignals = value.Uint() case "band.tunnel.v1beta1.Params.base_packet_fee": lv := value.List() - clv := lv.(*_Params_4_list) + clv := lv.(*_Params_7_list) x.BasePacketFee = *clv.list default: if fd.IsExtension() { @@ -365,10 +416,16 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore if x.BasePacketFee == nil { x.BasePacketFee = []*v1beta1.Coin{} } - value := &_Params_4_list{list: &x.BasePacketFee} + value := &_Params_7_list{list: &x.BasePacketFee} return protoreflect.ValueOfList(value) case "band.tunnel.v1beta1.Params.min_interval": panic(fmt.Errorf("field min_interval of message band.tunnel.v1beta1.Params is not mutable")) + case "band.tunnel.v1beta1.Params.max_interval": + panic(fmt.Errorf("field max_interval of message band.tunnel.v1beta1.Params is not mutable")) + case "band.tunnel.v1beta1.Params.min_deviation_bps": + panic(fmt.Errorf("field min_deviation_bps of message band.tunnel.v1beta1.Params is not mutable")) + case "band.tunnel.v1beta1.Params.max_deviation_bps": + panic(fmt.Errorf("field max_deviation_bps of message band.tunnel.v1beta1.Params is not mutable")) case "band.tunnel.v1beta1.Params.max_signals": panic(fmt.Errorf("field max_signals of message band.tunnel.v1beta1.Params is not mutable")) default: @@ -389,11 +446,17 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor return protoreflect.ValueOfList(&_Params_1_list{list: &list}) case "band.tunnel.v1beta1.Params.min_interval": return protoreflect.ValueOfUint64(uint64(0)) + case "band.tunnel.v1beta1.Params.max_interval": + return protoreflect.ValueOfUint64(uint64(0)) + case "band.tunnel.v1beta1.Params.min_deviation_bps": + return protoreflect.ValueOfUint64(uint64(0)) + case "band.tunnel.v1beta1.Params.max_deviation_bps": + return protoreflect.ValueOfUint64(uint64(0)) case "band.tunnel.v1beta1.Params.max_signals": return protoreflect.ValueOfUint64(uint64(0)) case "band.tunnel.v1beta1.Params.base_packet_fee": list := []*v1beta1.Coin{} - return protoreflect.ValueOfList(&_Params_4_list{list: &list}) + return protoreflect.ValueOfList(&_Params_7_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: band.tunnel.v1beta1.Params")) @@ -472,6 +535,15 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if x.MinInterval != 0 { n += 1 + runtime.Sov(uint64(x.MinInterval)) } + if x.MaxInterval != 0 { + n += 1 + runtime.Sov(uint64(x.MaxInterval)) + } + if x.MinDeviationBps != 0 { + n += 1 + runtime.Sov(uint64(x.MinDeviationBps)) + } + if x.MaxDeviationBps != 0 { + n += 1 + runtime.Sov(uint64(x.MaxDeviationBps)) + } if x.MaxSignals != 0 { n += 1 + runtime.Sov(uint64(x.MaxSignals)) } @@ -523,12 +595,27 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x3a } } if x.MaxSignals != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxSignals)) i-- + dAtA[i] = 0x30 + } + if x.MaxDeviationBps != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxDeviationBps)) + i-- + dAtA[i] = 0x28 + } + if x.MinDeviationBps != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MinDeviationBps)) + i-- + dAtA[i] = 0x20 + } + if x.MaxInterval != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxInterval)) + i-- dAtA[i] = 0x18 } if x.MinInterval != 0 { @@ -655,6 +742,63 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } } case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxInterval", wireType) + } + x.MaxInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.MaxInterval |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinDeviationBps", wireType) + } + x.MinDeviationBps = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.MinDeviationBps |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxDeviationBps", wireType) + } + x.MaxDeviationBps = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.MaxDeviationBps |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxSignals", wireType) } @@ -673,7 +817,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { break } } - case 4: + case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BasePacketFee", wireType) } @@ -765,10 +909,16 @@ type Params struct { MinDeposit []*v1beta1.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` // min_interval is the minimum interval in seconds MinInterval uint64 `protobuf:"varint,2,opt,name=min_interval,json=minInterval,proto3" json:"min_interval,omitempty"` + // max_interval is the maximum interval in seconds + MaxInterval uint64 `protobuf:"varint,3,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` + // min_deviation_bps is the minimum deviation in basis points + MinDeviationBps uint64 `protobuf:"varint,4,opt,name=min_deviation_bps,json=minDeviationBps,proto3" json:"min_deviation_bps,omitempty"` + // max_deviation_bps is the maximum deviation in basis points + MaxDeviationBps uint64 `protobuf:"varint,5,opt,name=max_deviation_bps,json=maxDeviationBps,proto3" json:"max_deviation_bps,omitempty"` // max_signals defines the maximum number of signals allowed per tunnel. - MaxSignals uint64 `protobuf:"varint,3,opt,name=max_signals,json=maxSignals,proto3" json:"max_signals,omitempty"` + MaxSignals uint64 `protobuf:"varint,6,opt,name=max_signals,json=maxSignals,proto3" json:"max_signals,omitempty"` // base_packet_fee is the base fee for each packet - BasePacketFee []*v1beta1.Coin `protobuf:"bytes,4,rep,name=base_packet_fee,json=basePacketFee,proto3" json:"base_packet_fee,omitempty"` + BasePacketFee []*v1beta1.Coin `protobuf:"bytes,7,rep,name=base_packet_fee,json=basePacketFee,proto3" json:"base_packet_fee,omitempty"` } func (x *Params) Reset() { @@ -805,6 +955,27 @@ func (x *Params) GetMinInterval() uint64 { return 0 } +func (x *Params) GetMaxInterval() uint64 { + if x != nil { + return x.MaxInterval + } + return 0 +} + +func (x *Params) GetMinDeviationBps() uint64 { + if x != nil { + return x.MinDeviationBps + } + return 0 +} + +func (x *Params) GetMaxDeviationBps() uint64 { + if x != nil { + return x.MaxDeviationBps + } + return 0 +} + func (x *Params) GetMaxSignals() uint64 { if x != nil { return x.MaxSignals @@ -828,7 +999,7 @@ var file_band_tunnel_v1beta1_params_proto_rawDesc = []byte{ 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb5, 0x02, + 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x6c, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, @@ -838,31 +1009,42 @@ var file_band_tunnel_v1beta1_params_proto_rawDesc = []byte{ 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x69, - 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, - 0x6d, 0x61, 0x78, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x12, 0x73, 0x0a, 0x0f, 0x62, 0x61, - 0x73, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, - 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, - 0x52, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x65, 0x65, 0x3a, - 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xdc, 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, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x78, + 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0b, 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x3f, 0x0a, 0x11, + 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x70, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x13, 0xe2, 0xde, 0x1f, 0x0f, 0x4d, 0x69, 0x6e, + 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x50, 0x53, 0x52, 0x0f, 0x6d, 0x69, + 0x6e, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x70, 0x73, 0x12, 0x3f, 0x0a, + 0x11, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, + 0x70, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x13, 0xe2, 0xde, 0x1f, 0x0f, 0x4d, 0x61, + 0x78, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x50, 0x53, 0x52, 0x0f, 0x6d, + 0x61, 0x78, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x70, 0x73, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x12, + 0x73, 0x0a, 0x0f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x66, + 0x65, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x46, 0x65, 0x65, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xdc, 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, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/band/tunnel/v1beta1/params.proto b/proto/band/tunnel/v1beta1/params.proto index 59a954202..05fbfe5ef 100644 --- a/proto/band/tunnel/v1beta1/params.proto +++ b/proto/band/tunnel/v1beta1/params.proto @@ -15,9 +15,15 @@ message Params { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; // min_interval is the minimum interval in seconds uint64 min_interval = 2; + // max_interval is the maximum interval in seconds + uint64 max_interval = 3; + // min_deviation_bps is the minimum deviation in basis points + uint64 min_deviation_bps = 4 [(gogoproto.customname) = "MinDeviationBPS"]; + // max_deviation_bps is the maximum deviation in basis points + uint64 max_deviation_bps = 5 [(gogoproto.customname) = "MaxDeviationBPS"]; // max_signals defines the maximum number of signals allowed per tunnel. - uint64 max_signals = 3; + uint64 max_signals = 6; // base_packet_fee is the base fee for each packet - repeated cosmos.base.v1beta1.Coin base_packet_fee = 4 + repeated cosmos.base.v1beta1.Coin base_packet_fee = 7 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } diff --git a/x/tunnel/keeper/msg_server.go b/x/tunnel/keeper/msg_server.go index feb55e576..10586929d 100644 --- a/x/tunnel/keeper/msg_server.go +++ b/x/tunnel/keeper/msg_server.go @@ -31,14 +31,21 @@ func (ms msgServer) CreateTunnel( ) (*types.MsgCreateTunnelResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // validate signal infos and interval params := ms.Keeper.GetParams(ctx) - if len(msg.SignalDeviations) > int(params.MaxSignals) { - return nil, types.ErrMaxSignalsExceeded + + // validate signal infos and interval + if err := types.ValidateSignalDeviations(msg.SignalDeviations, params); err != nil { + return nil, err } - if msg.Interval < params.MinInterval { - return nil, types.ErrIntervalTooLow + // validate interval + if msg.Interval < params.MinInterval || msg.Interval > params.MaxInterval { + return nil, types.ErrIntervalOutOfRange.Wrapf( + "max %d, min %d, got %d", + params.MaxInterval, + params.MinInterval, + msg.Interval, + ) } creator, err := sdk.AccAddressFromBech32(msg.Creator) @@ -83,13 +90,21 @@ func (ms msgServer) UpdateAndResetTunnel( ) (*types.MsgUpdateAndResetTunnelResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // validate signal infos and interval params := ms.Keeper.GetParams(ctx) - if len(msg.SignalDeviations) > int(params.MaxSignals) { - return nil, types.ErrMaxSignalsExceeded + + // validate signal infos and interval + if err := types.ValidateSignalDeviations(msg.SignalDeviations, params); err != nil { + return nil, err } - if msg.Interval < params.MinInterval { - return nil, types.ErrIntervalTooLow + + // validate interval + if msg.Interval < params.MinInterval || msg.Interval > params.MaxInterval { + return nil, types.ErrIntervalOutOfRange.Wrapf( + "max %d, min %d, got %d", + params.MaxInterval, + params.MinInterval, + msg.Interval, + ) } tunnel, err := ms.Keeper.GetTunnel(ctx, msg.TunnelID) diff --git a/x/tunnel/keeper/msg_server_test.go b/x/tunnel/keeper/msg_server_test.go index d63786ec2..73bc36b6f 100644 --- a/x/tunnel/keeper/msg_server_test.go +++ b/x/tunnel/keeper/msg_server_test.go @@ -43,7 +43,7 @@ func (s *KeeperTestSuite) TestMsgCreateTunnel() { return types.NewMsgCreateTunnel( signalDeviations, - 10, + 60, route, feedstypes.ENCODER_FIXED_POINT_ABI, sdk.NewCoins(sdk.NewCoin("uband", sdkmath.NewInt(100))), @@ -53,7 +53,26 @@ func (s *KeeperTestSuite) TestMsgCreateTunnel() { expErr: true, expErrMsg: "max signals exceeded", }, - "interval too low": { + "deviation out of range": { + preRun: func() (*types.MsgCreateTunnel, error) { + params := types.DefaultParams() + params.MinDeviationBPS = 1000 + params.MaxDeviationBPS = 10000 + s.Require().NoError(s.keeper.SetParams(s.ctx, params)) + + return types.NewMsgCreateTunnel( + signalDeviations, + 60, + route, + feedstypes.ENCODER_FIXED_POINT_ABI, + sdk.NewCoins(sdk.NewCoin("uband", sdkmath.NewInt(100))), + sdk.AccAddress([]byte("creator_address")), + ) + }, + expErr: true, + expErrMsg: "deviation out of range", + }, + "interval out of range": { preRun: func() (*types.MsgCreateTunnel, error) { params := types.DefaultParams() params.MinInterval = 5 @@ -69,7 +88,7 @@ func (s *KeeperTestSuite) TestMsgCreateTunnel() { ) }, expErr: true, - expErrMsg: "interval too low", + expErrMsg: "interval out of range", }, "all good without initial deposit": { preRun: func() (*types.MsgCreateTunnel, error) { @@ -81,7 +100,7 @@ func (s *KeeperTestSuite) TestMsgCreateTunnel() { return types.NewMsgCreateTunnel( signalDeviations, - 10, + 60, route, feedstypes.ENCODER_FIXED_POINT_ABI, sdk.NewCoins(), @@ -107,7 +126,7 @@ func (s *KeeperTestSuite) TestMsgCreateTunnel() { return types.NewMsgCreateTunnel( signalDeviations, - 10, + 60, route, feedstypes.ENCODER_FIXED_POINT_ABI, depositAmount, @@ -169,14 +188,42 @@ func (s *KeeperTestSuite) TestMsgUpdateAndResetTunnel() { return types.NewMsgUpdateAndResetTunnel( 1, editedSignalDeviations, - 10, + 60, sdk.AccAddress([]byte("creator_address")).String(), ) }, expErr: true, expErrMsg: "max signals exceeded", }, - "interval too low": { + "deviation out of range": { + preRun: func() *types.MsgUpdateAndResetTunnel { + params := types.DefaultParams() + params.MinDeviationBPS = 1000 + params.MaxDeviationBPS = 10000 + err := s.keeper.SetParams(s.ctx, params) + s.Require().NoError(err) + + s.AddSampleTunnel(false) + + editedSignalDeviations := []types.SignalDeviation{ + { + SignalID: "BTC", + SoftDeviationBPS: 200, + HardDeviationBPS: 200, + }, + } + + return types.NewMsgUpdateAndResetTunnel( + 1, + editedSignalDeviations, + 60, + sdk.AccAddress([]byte("creator_address")).String(), + ) + }, + expErr: true, + expErrMsg: "deviation out of range", + }, + "interval out of range": { preRun: func() *types.MsgUpdateAndResetTunnel { params := types.DefaultParams() params.MinInterval = 5 @@ -201,14 +248,14 @@ func (s *KeeperTestSuite) TestMsgUpdateAndResetTunnel() { ) }, expErr: true, - expErrMsg: "interval too low", + expErrMsg: "interval out of range", }, "tunnel not found": { preRun: func() *types.MsgUpdateAndResetTunnel { return types.NewMsgUpdateAndResetTunnel( 1, []types.SignalDeviation{}, - 10, + 60, sdk.AccAddress([]byte("creator_address")).String(), ) }, @@ -222,7 +269,7 @@ func (s *KeeperTestSuite) TestMsgUpdateAndResetTunnel() { return types.NewMsgUpdateAndResetTunnel( 1, []types.SignalDeviation{}, - 10, + 60, sdk.AccAddress([]byte("wrong_creator_address")).String(), ) }, @@ -244,7 +291,7 @@ func (s *KeeperTestSuite) TestMsgUpdateAndResetTunnel() { return types.NewMsgUpdateAndResetTunnel( 1, editedSignalDeviations, - 10, + 60, sdk.AccAddress([]byte("creator_address")).String(), ) }, diff --git a/x/tunnel/types/errors.go b/x/tunnel/types/errors.go index 66d0922b2..7b14aa6c7 100644 --- a/x/tunnel/types/errors.go +++ b/x/tunnel/types/errors.go @@ -8,20 +8,21 @@ import ( var ( ErrInvalidGenesis = errorsmod.Register(ModuleName, 2, "invalid genesis") ErrMaxSignalsExceeded = errorsmod.Register(ModuleName, 3, "max signals exceeded") - ErrIntervalTooLow = errorsmod.Register(ModuleName, 4, "interval too low") - ErrTunnelNotFound = errorsmod.Register(ModuleName, 5, "tunnel not found") - ErrLatestPricesNotFound = errorsmod.Register(ModuleName, 6, "latest prices not found") - ErrPacketNotFound = errorsmod.Register(ModuleName, 7, "packet not found") - ErrNoPacketContent = errorsmod.Register(ModuleName, 8, "no packet content") - ErrInvalidTunnelCreator = errorsmod.Register(ModuleName, 9, "invalid creator of the tunnel") - ErrAccountAlreadyExist = errorsmod.Register(ModuleName, 10, "account already exist") - ErrInvalidRoute = errorsmod.Register(ModuleName, 11, "invalid tunnel route") - ErrInactiveTunnel = errorsmod.Register(ModuleName, 12, "inactive tunnel") - ErrAlreadyActive = errorsmod.Register(ModuleName, 13, "already active") - ErrAlreadyInactive = errorsmod.Register(ModuleName, 14, "already inactive") - ErrInvalidDepositDenom = errorsmod.Register(ModuleName, 15, "invalid deposit denom") - ErrDepositNotFound = errorsmod.Register(ModuleName, 16, "deposit not found") - ErrInsufficientDeposit = errorsmod.Register(ModuleName, 17, "insufficient deposit") - ErrInsufficientFund = errorsmod.Register(ModuleName, 18, "insufficient fund") - ErrDeviationNotFound = errorsmod.Register(ModuleName, 19, "deviation not found") + ErrIntervalOutOfRange = errorsmod.Register(ModuleName, 4, "interval out of range") + ErrDeviationOutOfRange = errorsmod.Register(ModuleName, 5, "deviation out of range") + ErrTunnelNotFound = errorsmod.Register(ModuleName, 6, "tunnel not found") + ErrLatestPricesNotFound = errorsmod.Register(ModuleName, 7, "latest prices not found") + ErrPacketNotFound = errorsmod.Register(ModuleName, 8, "packet not found") + ErrNoPacketContent = errorsmod.Register(ModuleName, 9, "no packet content") + ErrInvalidTunnelCreator = errorsmod.Register(ModuleName, 10, "invalid creator of the tunnel") + ErrAccountAlreadyExist = errorsmod.Register(ModuleName, 11, "account already exist") + ErrInvalidRoute = errorsmod.Register(ModuleName, 12, "invalid tunnel route") + ErrInactiveTunnel = errorsmod.Register(ModuleName, 13, "inactive tunnel") + ErrAlreadyActive = errorsmod.Register(ModuleName, 14, "already active") + ErrAlreadyInactive = errorsmod.Register(ModuleName, 15, "already inactive") + ErrInvalidDepositDenom = errorsmod.Register(ModuleName, 16, "invalid deposit denom") + ErrDepositNotFound = errorsmod.Register(ModuleName, 17, "deposit not found") + ErrInsufficientDeposit = errorsmod.Register(ModuleName, 18, "insufficient deposit") + ErrInsufficientFund = errorsmod.Register(ModuleName, 19, "insufficient fund") + ErrDeviationNotFound = errorsmod.Register(ModuleName, 20, "deviation not found") ) diff --git a/x/tunnel/types/params.go b/x/tunnel/types/params.go index fde56d942..fab42e267 100644 --- a/x/tunnel/types/params.go +++ b/x/tunnel/types/params.go @@ -7,24 +7,35 @@ import ( ) var ( - DefaultMinInterval = uint64(1) - DefaultMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uband", 1_000_000_000)) - DefaultMaxSignals = uint64(100) - DefaultBasePacketFee = sdk.NewCoins(sdk.NewInt64Coin("uband", 10_000)) + // Each value below is the default value for each parameter when generating the default + // genesis file. See comments in types.proto for explanation for each parameter. + DefaultMinInterval = uint64(60) + DefaultMaxInterval = uint64(3600) + DefaultMinDeviationBPS = uint64(50) + DefaultMaxDeviationBPS = uint64(3000) + DefaultMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uband", 1_000_000_000)) + DefaultMaxSignals = uint64(25) + DefaultBasePacketFee = sdk.NewCoins(sdk.NewInt64Coin("uband", 10_000)) ) // NewParams creates a new Params instance func NewParams( minDeposit sdk.Coins, minInterval uint64, + maxInterval uint64, + minDeviationBPS uint64, + maxDeviationBPS uint64, maxSignals uint64, basePacketFee sdk.Coins, ) Params { return Params{ - MinDeposit: minDeposit, - MinInterval: minInterval, - MaxSignals: maxSignals, - BasePacketFee: basePacketFee, + MinDeposit: minDeposit, + MinInterval: minInterval, + MaxInterval: maxInterval, + MinDeviationBPS: minInterval, + MaxDeviationBPS: maxDeviationBPS, + MaxSignals: maxSignals, + BasePacketFee: basePacketFee, } } @@ -33,6 +44,9 @@ func DefaultParams() Params { return NewParams( DefaultMinDeposit, DefaultMinInterval, + DefaultMaxInterval, + DefaultMinDeviationBPS, + DefaultMaxDeviationBPS, DefaultMaxSignals, DefaultBasePacketFee, ) @@ -50,6 +64,35 @@ func (p Params) Validate() error { return err } + // validate MaxInterval + if err := validateUint64("max interval", true)(p.MaxInterval); err != nil { + return err + } + + // validate max interval is greater than min interval + if p.MaxInterval <= p.MinInterval { + return fmt.Errorf("max interval must be greater than min interval: %d <= %d", p.MaxInterval, p.MinInterval) + } + + // validate MinDeviationBPS + if err := validateUint64("min deviation bps", true)(p.MinDeviationBPS); err != nil { + return err + } + + // validate MaxDeviationBPS + if err := validateUint64("max deviation bps", true)(p.MaxDeviationBPS); err != nil { + return err + } + + // validate max deviation bps is greater than min deviation bps + if p.MaxDeviationBPS <= p.MinDeviationBPS { + return fmt.Errorf( + "max deviation bps must be greater than min deviation bps: %d <= %d", + p.MaxDeviationBPS, + p.MinDeviationBPS, + ) + } + // validate MaxSignals if err := validateUint64("max signals", true)(p.MaxSignals); err != nil { return err diff --git a/x/tunnel/types/params.pb.go b/x/tunnel/types/params.pb.go index 67996ab45..b210d86c5 100644 --- a/x/tunnel/types/params.pb.go +++ b/x/tunnel/types/params.pb.go @@ -31,10 +31,16 @@ type Params struct { MinDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_deposit"` // min_interval is the minimum interval in seconds MinInterval uint64 `protobuf:"varint,2,opt,name=min_interval,json=minInterval,proto3" json:"min_interval,omitempty"` + // max_interval is the maximum interval in seconds + MaxInterval uint64 `protobuf:"varint,3,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` + // min_deviation_bps is the minimum deviation in basis points + MinDeviationBPS uint64 `protobuf:"varint,4,opt,name=min_deviation_bps,json=minDeviationBps,proto3" json:"min_deviation_bps,omitempty"` + // max_deviation_bps is the maximum deviation in basis points + MaxDeviationBPS uint64 `protobuf:"varint,5,opt,name=max_deviation_bps,json=maxDeviationBps,proto3" json:"max_deviation_bps,omitempty"` // max_signals defines the maximum number of signals allowed per tunnel. - MaxSignals uint64 `protobuf:"varint,3,opt,name=max_signals,json=maxSignals,proto3" json:"max_signals,omitempty"` + MaxSignals uint64 `protobuf:"varint,6,opt,name=max_signals,json=maxSignals,proto3" json:"max_signals,omitempty"` // base_packet_fee is the base fee for each packet - BasePacketFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=base_packet_fee,json=basePacketFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"base_packet_fee"` + BasePacketFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=base_packet_fee,json=basePacketFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"base_packet_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -84,6 +90,27 @@ func (m *Params) GetMinInterval() uint64 { return 0 } +func (m *Params) GetMaxInterval() uint64 { + if m != nil { + return m.MaxInterval + } + return 0 +} + +func (m *Params) GetMinDeviationBPS() uint64 { + if m != nil { + return m.MinDeviationBPS + } + return 0 +} + +func (m *Params) GetMaxDeviationBPS() uint64 { + if m != nil { + return m.MaxDeviationBPS + } + return 0 +} + func (m *Params) GetMaxSignals() uint64 { if m != nil { return m.MaxSignals @@ -105,28 +132,32 @@ func init() { func init() { proto.RegisterFile("band/tunnel/v1beta1/params.proto", fileDescriptor_842b3bf03f22bf82) } var fileDescriptor_842b3bf03f22bf82 = []byte{ - // 332 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x91, 0xb1, 0x4e, 0x02, 0x31, - 0x18, 0xc7, 0xef, 0x80, 0x30, 0x14, 0x8d, 0xc9, 0xe9, 0x70, 0x32, 0xf4, 0xd0, 0x89, 0xc5, 0x56, - 0x64, 0x73, 0x44, 0x63, 0xc2, 0x46, 0x70, 0x73, 0xb9, 0xf4, 0x4a, 0x3d, 0x1a, 0xae, 0xed, 0x85, - 0x16, 0x82, 0x6f, 0xe1, 0x23, 0x38, 0xbb, 0xfb, 0x0e, 0x8c, 0x8c, 0x4e, 0x6a, 0x60, 0xf1, 0x31, - 0x4c, 0xdb, 0xc3, 0xf8, 0x00, 0x4e, 0x6d, 0xbe, 0xef, 0xd7, 0xdf, 0xff, 0x4b, 0x3f, 0xd0, 0xc9, - 0x88, 0x9c, 0x60, 0xb3, 0x90, 0x92, 0x15, 0x78, 0xd9, 0xcb, 0x98, 0x21, 0x3d, 0x5c, 0x92, 0x39, - 0x11, 0x1a, 0x95, 0x73, 0x65, 0x54, 0x74, 0x6c, 0x09, 0xe4, 0x09, 0x54, 0x11, 0xed, 0x93, 0x5c, - 0xe5, 0xca, 0xf5, 0xb1, 0xbd, 0x79, 0xb4, 0x0d, 0xa9, 0xd2, 0x42, 0x69, 0x9c, 0x11, 0xcd, 0x7e, - 0x65, 0x54, 0x71, 0xe9, 0xfb, 0xe7, 0x6f, 0x35, 0xd0, 0x1c, 0x39, 0x77, 0x54, 0x80, 0x96, 0xe0, - 0x32, 0x9d, 0xb0, 0x52, 0x69, 0x6e, 0xe2, 0xb0, 0x53, 0xef, 0xb6, 0xae, 0x4e, 0x91, 0x17, 0x20, - 0x2b, 0xd8, 0x67, 0xa1, 0x1b, 0xc5, 0xe5, 0xe0, 0x72, 0xfd, 0x91, 0x04, 0xaf, 0x9f, 0x49, 0x37, - 0xe7, 0x66, 0xba, 0xc8, 0x10, 0x55, 0x02, 0x57, 0x69, 0xfe, 0xb8, 0xd0, 0x93, 0x19, 0x36, 0x4f, - 0x25, 0xd3, 0xee, 0x81, 0x1e, 0x03, 0xc1, 0xe5, 0xad, 0xd7, 0x47, 0x67, 0xe0, 0xc0, 0xa6, 0x71, - 0x69, 0xd8, 0x7c, 0x49, 0x8a, 0xb8, 0xd6, 0x09, 0xbb, 0x8d, 0xb1, 0x9d, 0x60, 0x58, 0x95, 0xa2, - 0x04, 0xb4, 0x04, 0x59, 0xa5, 0x9a, 0xe7, 0x92, 0x14, 0x3a, 0xae, 0x3b, 0x02, 0x08, 0xb2, 0xba, - 0xf7, 0x95, 0x48, 0x83, 0x23, 0x3b, 0x56, 0x5a, 0x12, 0x3a, 0x63, 0x26, 0x7d, 0x64, 0x2c, 0x6e, - 0xfc, 0xff, 0xd4, 0x87, 0x56, 0x32, 0x72, 0x11, 0x77, 0x8c, 0x5d, 0x37, 0xbe, 0x5f, 0x92, 0x70, - 0x30, 0x5c, 0x6f, 0x61, 0xb8, 0xd9, 0xc2, 0xf0, 0x6b, 0x0b, 0xc3, 0xe7, 0x1d, 0x0c, 0x36, 0x3b, - 0x18, 0xbc, 0xef, 0x60, 0xf0, 0x80, 0xff, 0x88, 0xed, 0x9e, 0xdc, 0x3f, 0x53, 0x55, 0x60, 0x3a, - 0x25, 0x5c, 0xe2, 0x65, 0x1f, 0xaf, 0xf6, 0xcb, 0x75, 0x29, 0x59, 0xd3, 0x11, 0xfd, 0x9f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x24, 0xea, 0x35, 0x13, 0xf8, 0x01, 0x00, 0x00, + // 398 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x31, 0x8f, 0xda, 0x30, + 0x14, 0xc7, 0x93, 0x42, 0xa9, 0x64, 0x5a, 0xa1, 0x86, 0x0e, 0x29, 0x43, 0x42, 0x3b, 0xb1, 0x34, + 0x2e, 0x65, 0xeb, 0x52, 0x29, 0xad, 0x2a, 0x31, 0x54, 0x42, 0xb0, 0x75, 0x89, 0x9c, 0xe0, 0x06, + 0x8b, 0xc4, 0xb6, 0xb0, 0x89, 0xd2, 0x6f, 0x71, 0x1f, 0xe1, 0xe6, 0xfb, 0x24, 0x8c, 0x8c, 0xa7, + 0x1b, 0xb8, 0x53, 0x58, 0xee, 0x63, 0x9c, 0x6c, 0x07, 0x2e, 0x62, 0xbe, 0x29, 0xd1, 0x7b, 0x3f, + 0xff, 0xfe, 0x4f, 0x4f, 0x0f, 0x0c, 0x63, 0x44, 0x97, 0x50, 0x6e, 0x29, 0xc5, 0x19, 0x2c, 0xc6, + 0x31, 0x96, 0x68, 0x0c, 0x39, 0xda, 0xa0, 0x5c, 0x04, 0x7c, 0xc3, 0x24, 0x73, 0xfa, 0x8a, 0x08, + 0x0c, 0x11, 0xd4, 0xc4, 0xe0, 0x43, 0xca, 0x52, 0xa6, 0xfb, 0x50, 0xfd, 0x19, 0x74, 0xe0, 0x25, + 0x4c, 0xe4, 0x4c, 0xc0, 0x18, 0x09, 0x7c, 0x96, 0x25, 0x8c, 0x50, 0xd3, 0xff, 0x7c, 0xd7, 0x02, + 0x9d, 0x99, 0x76, 0x3b, 0x19, 0xe8, 0xe6, 0x84, 0x46, 0x4b, 0xcc, 0x99, 0x20, 0xd2, 0xb5, 0x87, + 0xad, 0x51, 0xf7, 0xdb, 0xc7, 0xc0, 0x08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, 0x1d, 0x3d, 0x6b, + 0x7f, 0xf4, 0xac, 0xdb, 0xa3, 0x67, 0xfd, 0x85, 0x0d, 0xb1, 0x3a, 0x26, 0x7d, 0x0c, 0x09, 0xcb, + 0x60, 0xb2, 0x42, 0x84, 0xc2, 0x62, 0x02, 0xcb, 0xd3, 0x05, 0xea, 0x94, 0xb8, 0xa3, 0x89, 0xc9, + 0x53, 0x00, 0x00, 0x00, 0xff, 0xff, 0x57, 0x4c, 0x65, 0x68, 0x9d, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -159,6 +190,15 @@ func (this *Params) Equal(that interface{}) bool { if this.MinInterval != that1.MinInterval { return false } + if this.MaxInterval != that1.MaxInterval { + return false + } + if this.MinDeviationBPS != that1.MinDeviationBPS { + return false + } + if this.MaxDeviationBPS != that1.MaxDeviationBPS { + return false + } if this.MaxSignals != that1.MaxSignals { return false } @@ -203,12 +243,27 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x3a } } if m.MaxSignals != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MaxSignals)) i-- + dAtA[i] = 0x30 + } + if m.MaxDeviationBPS != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxDeviationBPS)) + i-- + dAtA[i] = 0x28 + } + if m.MinDeviationBPS != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinDeviationBPS)) + i-- + dAtA[i] = 0x20 + } + if m.MaxInterval != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxInterval)) + i-- dAtA[i] = 0x18 } if m.MinInterval != 0 { @@ -259,6 +314,15 @@ func (m *Params) Size() (n int) { if m.MinInterval != 0 { n += 1 + sovParams(uint64(m.MinInterval)) } + if m.MaxInterval != 0 { + n += 1 + sovParams(uint64(m.MaxInterval)) + } + if m.MinDeviationBPS != 0 { + n += 1 + sovParams(uint64(m.MinDeviationBPS)) + } + if m.MaxDeviationBPS != 0 { + n += 1 + sovParams(uint64(m.MaxDeviationBPS)) + } if m.MaxSignals != 0 { n += 1 + sovParams(uint64(m.MaxSignals)) } @@ -360,6 +424,63 @@ func (m *Params) Unmarshal(dAtA []byte) error { } } case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxInterval", wireType) + } + m.MaxInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxInterval |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeviationBPS", wireType) + } + m.MinDeviationBPS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinDeviationBPS |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDeviationBPS", wireType) + } + m.MaxDeviationBPS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxDeviationBPS |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MaxSignals", wireType) } @@ -378,7 +499,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 4: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BasePacketFee", wireType) } diff --git a/x/tunnel/types/params_test.go b/x/tunnel/types/params_test.go index f8a4b6054..00491d4fa 100644 --- a/x/tunnel/types/params_test.go +++ b/x/tunnel/types/params_test.go @@ -23,6 +23,53 @@ func TestParams_Validate(t *testing.T) { expErr: true, expErrMsg: "min interval must be positive", }, + "invalid MaxInterval": { + genesisState: func() types.Params { + p := types.DefaultParams() + p.MaxInterval = 0 + return p + }(), + expErr: true, + expErrMsg: "max interval must be positive", + }, + "invalid interval range": { + genesisState: func() types.Params { + p := types.DefaultParams() + p.MinInterval = 10 + p.MaxInterval = 5 + return p + }(), + expErr: true, + expErrMsg: "max interval must be greater than min interval: 5 <= 10", + }, + "invalid MinDeviationBPS": { + genesisState: func() types.Params { + p := types.DefaultParams() + p.MinDeviationBPS = 0 + return p + }(), + expErr: true, + expErrMsg: "min deviation bps must be positive", + }, + "invalid MaxDeviationBPS": { + genesisState: func() types.Params { + p := types.DefaultParams() + p.MaxDeviationBPS = 0 + return p + }(), + expErr: true, + expErrMsg: "max deviation bps must be positive", + }, + "invalid deviation range": { + genesisState: func() types.Params { + p := types.DefaultParams() + p.MinDeviationBPS = 10 + p.MaxDeviationBPS = 5 + return p + }(), + expErr: true, + expErrMsg: "max deviation bps must be greater than min deviation bps: 5 <= 10", + }, "invalid MaxSignals": { genesisState: func() types.Params { p := types.DefaultParams() diff --git a/x/tunnel/types/signal.go b/x/tunnel/types/signal.go index 643317f2e..35051c929 100644 --- a/x/tunnel/types/signal.go +++ b/x/tunnel/types/signal.go @@ -61,3 +61,28 @@ func (l *LatestPrices) UpdatePrices(newPrices []feedstypes.Price) { } } } + +// ValidateSignalDeviations validates the signal deviations with the given params. +func ValidateSignalDeviations(signalDeviations []SignalDeviation, params Params) error { + // validate max signals + if len(signalDeviations) > int(params.MaxSignals) { + return ErrMaxSignalsExceeded.Wrapf("max signals %d, got %d", params.MaxSignals, len(signalDeviations)) + } + + // validate min and max deviation + for _, signalDeviation := range signalDeviations { + if signalDeviation.HardDeviationBPS < params.MinDeviationBPS || + signalDeviation.SoftDeviationBPS < params.MinDeviationBPS || + signalDeviation.HardDeviationBPS > params.MaxDeviationBPS || + signalDeviation.SoftDeviationBPS > params.MaxDeviationBPS { + return ErrDeviationOutOfRange.Wrapf( + "min %d, max %d, got %d, %d", + params.MinDeviationBPS, + params.MaxDeviationBPS, + signalDeviation.SoftDeviationBPS, + signalDeviation.HardDeviationBPS, + ) + } + } + return nil +} From 37f48daf54407e0ec9ffcf26ad7442c40ba44877 Mon Sep 17 00:00:00 2001 From: satawatnack Date: Mon, 18 Nov 2024 16:02:20 +0700 Subject: [PATCH 2/5] clean up --- api/band/tunnel/v1beta1/params.pulsar.go | 12 ++++++------ proto/band/tunnel/v1beta1/params.proto | 12 ++++++------ x/tunnel/README.md | 12 +++++++++--- x/tunnel/types/params.pb.go | 12 ++++++------ 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/api/band/tunnel/v1beta1/params.pulsar.go b/api/band/tunnel/v1beta1/params.pulsar.go index 170fc8db1..30cfe5fef 100644 --- a/api/band/tunnel/v1beta1/params.pulsar.go +++ b/api/band/tunnel/v1beta1/params.pulsar.go @@ -905,19 +905,19 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // min_deposit is the minimum deposit required to create a tunnel + // min_deposit is the minimum deposit required to create a tunnel. MinDeposit []*v1beta1.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` - // min_interval is the minimum interval in seconds + // min_interval is the minimum interval in seconds. MinInterval uint64 `protobuf:"varint,2,opt,name=min_interval,json=minInterval,proto3" json:"min_interval,omitempty"` - // max_interval is the maximum interval in seconds + // max_interval is the maximum interval in seconds. MaxInterval uint64 `protobuf:"varint,3,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` - // min_deviation_bps is the minimum deviation in basis points + // min_deviation_bps is the minimum deviation in basis points. MinDeviationBps uint64 `protobuf:"varint,4,opt,name=min_deviation_bps,json=minDeviationBps,proto3" json:"min_deviation_bps,omitempty"` - // max_deviation_bps is the maximum deviation in basis points + // max_deviation_bps is the maximum deviation in basis points. MaxDeviationBps uint64 `protobuf:"varint,5,opt,name=max_deviation_bps,json=maxDeviationBps,proto3" json:"max_deviation_bps,omitempty"` // max_signals defines the maximum number of signals allowed per tunnel. MaxSignals uint64 `protobuf:"varint,6,opt,name=max_signals,json=maxSignals,proto3" json:"max_signals,omitempty"` - // base_packet_fee is the base fee for each packet + // base_packet_fee is the base fee for each packet. BasePacketFee []*v1beta1.Coin `protobuf:"bytes,7,rep,name=base_packet_fee,json=basePacketFee,proto3" json:"base_packet_fee,omitempty"` } diff --git a/proto/band/tunnel/v1beta1/params.proto b/proto/band/tunnel/v1beta1/params.proto index 05fbfe5ef..41e1f2bff 100644 --- a/proto/band/tunnel/v1beta1/params.proto +++ b/proto/band/tunnel/v1beta1/params.proto @@ -10,20 +10,20 @@ import "cosmos/base/v1beta1/coin.proto"; message Params { option (gogoproto.equal) = true; // Use gogoproto.equal for proto3 message equality checks - // min_deposit is the minimum deposit required to create a tunnel + // min_deposit is the minimum deposit required to create a tunnel. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - // min_interval is the minimum interval in seconds + // min_interval is the minimum interval in seconds. uint64 min_interval = 2; - // max_interval is the maximum interval in seconds + // max_interval is the maximum interval in seconds. uint64 max_interval = 3; - // min_deviation_bps is the minimum deviation in basis points + // min_deviation_bps is the minimum deviation in basis points. uint64 min_deviation_bps = 4 [(gogoproto.customname) = "MinDeviationBPS"]; - // max_deviation_bps is the maximum deviation in basis points + // max_deviation_bps is the maximum deviation in basis points. uint64 max_deviation_bps = 5 [(gogoproto.customname) = "MaxDeviationBPS"]; // max_signals defines the maximum number of signals allowed per tunnel. uint64 max_signals = 6; - // base_packet_fee is the base fee for each packet + // base_packet_fee is the base fee for each packet. repeated cosmos.base.v1beta1.Coin base_packet_fee = 7 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } diff --git a/x/tunnel/README.md b/x/tunnel/README.md index dca74cb9f..5421d50cf 100644 --- a/x/tunnel/README.md +++ b/x/tunnel/README.md @@ -22,7 +22,7 @@ The Tunnel module is designed to decentralize the creation of push-based price d - [ActiveTunnelID](#activetunnelid) - [Tunnel](#tunnel-1) - [Packet](#packet-1) - - [LatestPrices](#latestPrices) + - [LatestPrices](#latestprices) - [Deposit](#deposit) - [Params](#params) - [Msg](#msg) @@ -31,8 +31,8 @@ The Tunnel module is designed to decentralize the creation of push-based price d - [MsgActivate](#msgactivate) - [MsgDeactivate](#msgdeactivate) - [MsgTriggerTunnel](#msgtriggertunnel) - - [MsgDepositToTunnel](#MsgDepositToTunnel) - - [MsgWithdrawFromTunnel](#MsgWithdrawFromTunnel) + - [MsgDepositToTunnel](#msgdeposittotunnel) + - [MsgWithdrawFromTunnel](#msgwithdrawfromtunnel) - [Events](#events) - [Event: `create_tunnel`](#event-create_tunnel) - [Event: `update_and_reset_tunnel`](#event-update_and_reset_tunnel) @@ -189,6 +189,12 @@ type Params struct { MinDeposit sdk.Coins // MinInterval is the minimum interval in seconds. MinInterval uint64 + // MinInterval is the minimum interval in seconds. + MinInterval uint64 + // MinDeviationBPS is the minimum deviation in basis points. + MinDeviationBPS uint64 + // MaxDeviationBPS is the maximum deviation in basis points. + MaxDeviationBPS uint64 // MaxSignals defines the maximum number of signals allowed per tunnel. MaxSignals uint64 // BasePacketFee is the base fee for each packet. diff --git a/x/tunnel/types/params.pb.go b/x/tunnel/types/params.pb.go index b210d86c5..249c701bd 100644 --- a/x/tunnel/types/params.pb.go +++ b/x/tunnel/types/params.pb.go @@ -27,19 +27,19 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params is the data structure that keeps the parameters of the module. type Params struct { - // min_deposit is the minimum deposit required to create a tunnel + // min_deposit is the minimum deposit required to create a tunnel. MinDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_deposit"` - // min_interval is the minimum interval in seconds + // min_interval is the minimum interval in seconds. MinInterval uint64 `protobuf:"varint,2,opt,name=min_interval,json=minInterval,proto3" json:"min_interval,omitempty"` - // max_interval is the maximum interval in seconds + // max_interval is the maximum interval in seconds. MaxInterval uint64 `protobuf:"varint,3,opt,name=max_interval,json=maxInterval,proto3" json:"max_interval,omitempty"` - // min_deviation_bps is the minimum deviation in basis points + // min_deviation_bps is the minimum deviation in basis points. MinDeviationBPS uint64 `protobuf:"varint,4,opt,name=min_deviation_bps,json=minDeviationBps,proto3" json:"min_deviation_bps,omitempty"` - // max_deviation_bps is the maximum deviation in basis points + // max_deviation_bps is the maximum deviation in basis points. MaxDeviationBPS uint64 `protobuf:"varint,5,opt,name=max_deviation_bps,json=maxDeviationBps,proto3" json:"max_deviation_bps,omitempty"` // max_signals defines the maximum number of signals allowed per tunnel. MaxSignals uint64 `protobuf:"varint,6,opt,name=max_signals,json=maxSignals,proto3" json:"max_signals,omitempty"` - // base_packet_fee is the base fee for each packet + // base_packet_fee is the base fee for each packet. BasePacketFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=base_packet_fee,json=basePacketFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"base_packet_fee"` } From 9d54f77984761fd8778fcf79d1eb039b95024f0e Mon Sep 17 00:00:00 2001 From: satawatnack Date: Mon, 18 Nov 2024 17:06:17 +0700 Subject: [PATCH 3/5] add validate func --- x/tunnel/keeper/msg_server.go | 18 ++++-------------- x/tunnel/types/params.go | 4 ++-- x/tunnel/types/tunnel.go | 13 +++++++++++++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/x/tunnel/keeper/msg_server.go b/x/tunnel/keeper/msg_server.go index 10586929d..9bdf286f4 100644 --- a/x/tunnel/keeper/msg_server.go +++ b/x/tunnel/keeper/msg_server.go @@ -39,13 +39,8 @@ func (ms msgServer) CreateTunnel( } // validate interval - if msg.Interval < params.MinInterval || msg.Interval > params.MaxInterval { - return nil, types.ErrIntervalOutOfRange.Wrapf( - "max %d, min %d, got %d", - params.MaxInterval, - params.MinInterval, - msg.Interval, - ) + if err := types.ValidateInterval(msg.Interval, params); err != nil { + return nil, err } creator, err := sdk.AccAddressFromBech32(msg.Creator) @@ -98,13 +93,8 @@ func (ms msgServer) UpdateAndResetTunnel( } // validate interval - if msg.Interval < params.MinInterval || msg.Interval > params.MaxInterval { - return nil, types.ErrIntervalOutOfRange.Wrapf( - "max %d, min %d, got %d", - params.MaxInterval, - params.MinInterval, - msg.Interval, - ) + if err := types.ValidateInterval(msg.Interval, params); err != nil { + return nil, err } tunnel, err := ms.Keeper.GetTunnel(ctx, msg.TunnelID) diff --git a/x/tunnel/types/params.go b/x/tunnel/types/params.go index fab42e267..7d460f02f 100644 --- a/x/tunnel/types/params.go +++ b/x/tunnel/types/params.go @@ -70,7 +70,7 @@ func (p Params) Validate() error { } // validate max interval is greater than min interval - if p.MaxInterval <= p.MinInterval { + if p.MaxInterval < p.MinInterval { return fmt.Errorf("max interval must be greater than min interval: %d <= %d", p.MaxInterval, p.MinInterval) } @@ -85,7 +85,7 @@ func (p Params) Validate() error { } // validate max deviation bps is greater than min deviation bps - if p.MaxDeviationBPS <= p.MinDeviationBPS { + if p.MaxDeviationBPS < p.MinDeviationBPS { return fmt.Errorf( "max deviation bps must be greater than min deviation bps: %d <= %d", p.MaxDeviationBPS, diff --git a/x/tunnel/types/tunnel.go b/x/tunnel/types/tunnel.go index dcdc42605..e07193d85 100644 --- a/x/tunnel/types/tunnel.go +++ b/x/tunnel/types/tunnel.go @@ -89,3 +89,16 @@ func (t Tunnel) GetSignalIDs() []string { } return signalIDs } + +// ValidateInterval validates the interval. +func ValidateInterval(interval uint64, params Params) error { + if interval < params.MinInterval || interval > params.MaxInterval { + return ErrIntervalOutOfRange.Wrapf( + "max %d, min %d, got %d", + params.MaxInterval, + params.MinInterval, + interval, + ) + } + return nil +} From 0fa4776b1997514e50851760408ec075d28a9f48 Mon Sep 17 00:00:00 2001 From: Kitipong Sirirueangsakul Date: Mon, 18 Nov 2024 18:55:31 +0700 Subject: [PATCH 4/5] clean --- api/band/tunnel/v1beta1/tx.pulsar.go | 231 +++++++++++++-------------- proto/band/tunnel/v1beta1/tx.proto | 6 +- x/tunnel/types/tx.pb.go | 137 ++++++++-------- 3 files changed, 184 insertions(+), 190 deletions(-) diff --git a/api/band/tunnel/v1beta1/tx.pulsar.go b/api/band/tunnel/v1beta1/tx.pulsar.go index bf16e33bc..5eddb0a4e 100644 --- a/api/band/tunnel/v1beta1/tx.pulsar.go +++ b/api/band/tunnel/v1beta1/tx.pulsar.go @@ -8342,129 +8342,126 @@ var file_band_tunnel_v1beta1_tx_proto_rawDesc = []byte{ 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa1, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8f, 0x02, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x3b, 0x0a, 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1e, 0xe2, 0xde, 0x1f, 0x08, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0xea, 0xde, 0x1f, 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x49, 0x64, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x35, 0xc8, - 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, - 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x09, - 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x03, 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, 0x64, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x6f, 0x72, 0x3a, 0x2c, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x6f, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, - 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0xaa, 0x02, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, - 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x3b, 0x0a, 0x09, 0x74, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1e, 0xe2, - 0xde, 0x1f, 0x08, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0xea, 0xde, 0x1f, 0x09, 0x74, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x08, 0x74, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x42, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x18, - 0x03, 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, - 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x3a, 0x30, 0x82, 0xe7, 0xb0, - 0x2a, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, - 0x1c, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x1f, 0x0a, - 0x1d, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, 0x6d, - 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xaf, - 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x61, 0x6e, - 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x29, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x16, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xd0, 0x06, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x62, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x12, 0x24, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x2c, 0x2e, 0x62, 0x61, 0x6e, 0x64, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 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, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x35, 0xc8, 0xde, 0x1f, + 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x64, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x03, 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, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x3a, 0x2c, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x4d, 0x73, + 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x98, + 0x02, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, + 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 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, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x35, + 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, 0x0a, + 0x0a, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x18, 0x03, 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, 0x0a, 0x77, 0x69, 0x74, + 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x3a, 0x30, 0x82, 0xe7, 0xb0, 0x2a, 0x0a, 0x77, 0x69, + 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1c, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x2f, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, + 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, + 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x3a, 0x29, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x16, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xd0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x62, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, + 0x24, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x2c, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, + 0x52, 0x65, 0x73, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x2c, 0x2e, 0x62, 0x61, + 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x52, 0x65, + 0x73, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x34, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, - 0x2c, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x34, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x65, + 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x56, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x61, + 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, 0x28, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, - 0x20, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x1a, 0x28, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0a, 0x44, - 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x62, 0x61, 0x6e, 0x64, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0a, 0x44, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, + 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, 0x2a, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, 0x2a, 0x2e, + 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0d, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x25, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x2d, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0d, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x25, 0x2e, 0x62, 0x61, 0x6e, - 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x54, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x1a, 0x2d, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x6b, 0x0a, 0x0f, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x12, 0x27, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x2f, 0x2e, 0x62, - 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, - 0x12, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x12, 0x2a, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, - 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, - 0x32, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x0f, + 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, + 0x27, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x2f, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, + 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x12, 0x57, 0x69, 0x74, + 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, + 0x2a, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, - 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x62, 0x61, 0x6e, 0x64, - 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xd8, - 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, 0x07, 0x54, 0x78, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x77, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x1a, 0x32, 0x2e, 0x62, 0x61, + 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x46, 0x72, 0x6f, + 0x6d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x24, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x62, 0x61, 0x6e, 0x64, 0x2e, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xd8, 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, 0x07, 0x54, 0x78, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/band/tunnel/v1beta1/tx.proto b/proto/band/tunnel/v1beta1/tx.proto index cba95092d..2d3b02573 100644 --- a/proto/band/tunnel/v1beta1/tx.proto +++ b/proto/band/tunnel/v1beta1/tx.proto @@ -138,8 +138,7 @@ message MsgDepositToTunnel { option (amino.name) = "tunnel/MsgDepositToTunnel"; // tunnel_id defines the unique id of the tunnel. - uint64 tunnel_id = 1 - [(gogoproto.customname) = "TunnelID", (gogoproto.jsontag) = "tunnel_id", (amino.dont_omitempty) = true]; + uint64 tunnel_id = 1 [(gogoproto.customname) = "TunnelID"]; // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 2 [ @@ -161,8 +160,7 @@ message MsgWithdrawFromTunnel { option (amino.name) = "tunnel/MsgWithdrawFromTunnel"; // tunnel_id defines the unique id of the tunnel. - uint64 tunnel_id = 1 - [(gogoproto.customname) = "TunnelID", (gogoproto.jsontag) = "tunnel_id", (amino.dont_omitempty) = true]; + uint64 tunnel_id = 1 [(gogoproto.customname) = "TunnelID"]; // amount to be withdrawn by withdrawer. repeated cosmos.base.v1beta1.Coin amount = 2 [ diff --git a/x/tunnel/types/tx.pb.go b/x/tunnel/types/tx.pb.go index e6322a318..9cf253b0f 100644 --- a/x/tunnel/types/tx.pb.go +++ b/x/tunnel/types/tx.pb.go @@ -561,7 +561,7 @@ var xxx_messageInfo_MsgTriggerTunnelResponse proto.InternalMessageInfo // MsgDepositToTunnel defines a message to deposit to an existing tunnel. type MsgDepositToTunnel struct { // tunnel_id defines the unique id of the tunnel. - TunnelID uint64 `protobuf:"varint,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id"` + TunnelID uint64 `protobuf:"varint,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` // amount to be deposited by depositor. Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` // depositor defines the deposit addresses from the tunnel. @@ -662,7 +662,7 @@ var xxx_messageInfo_MsgDepositToTunnelResponse proto.InternalMessageInfo // MsgWithdrawFromTunnel is the transaction message to withdraw a deposit from an existing tunnel. type MsgWithdrawFromTunnel struct { // tunnel_id defines the unique id of the tunnel. - TunnelID uint64 `protobuf:"varint,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id"` + TunnelID uint64 `protobuf:"varint,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` // amount to be withdrawn by withdrawer. Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` // withdrawer defines the withdraw addresses from the tunnel. @@ -874,73 +874,72 @@ func init() { func init() { proto.RegisterFile("band/tunnel/v1beta1/tx.proto", fileDescriptor_d18351d83b4705d0) } var fileDescriptor_d18351d83b4705d0 = []byte{ - // 1059 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x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 0xf6, 0x9d, - 0x49, 0x87, 0xc7, 0x60, 0xda, 0xc6, 0x54, 0x30, 0x19, 0xe6, 0x09, 0x58, 0x4e, 0x76, 0xd7, 0xbb, - 0x93, 0x59, 0x8e, 0x01, 0x35, 0x73, 0x4a, 0xa0, 0x0c, 0x46, 0x81, 0x9a, 0xd2, 0x88, 0x26, 0xaa, - 0x72, 0x16, 0xab, 0xd5, 0xa6, 0xc7, 0xca, 0xa8, 0x2d, 0xb0, 0x34, 0xf6, 0xc2, 0xde, 0x3e, 0xff, - 0x16, 0x71, 0x94, 0xb6, 0x3e, 0x0d, 0x2a, 0x8c, 0xa1, 0xcd, 0x7d, 0x1d, 0x34, 0xad, 0xfa, 0xee, - 0xcb, 0xe3, 0x92, 0x72, 0x78, 0x5c, 0x52, 0xfe, 0x3e, 0x2e, 0x29, 0xdf, 0x9d, 0x94, 0x66, 0x0e, - 0x4f, 0x4a, 0x33, 0x7f, 0x9e, 0x94, 0x66, 0xbe, 0x30, 0x63, 0xdd, 0x2f, 0x70, 0xcc, 0xbe, 0xd3, - 0xdb, 0xb8, 0x6b, 0xb6, 0x3b, 0x36, 0xf2, 0xcc, 0xe1, 0x7d, 0xf3, 0x59, 0xf8, 0x8f, 0x07, 0x6b, - 0x85, 0xad, 0x1c, 0x43, 0xdc, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd2, 0xef, 0x4b, 0x21, 0xa1, + // 1043 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x3a, 0x89, 0x9b, 0x4c, 0xd2, 0xa6, 0xdd, 0xba, 0xc4, 0x5e, 0x82, 0x6d, 0x96, 0x56, + 0x75, 0xa3, 0x64, 0x97, 0xb8, 0x04, 0x41, 0x6e, 0x71, 0x0d, 0x52, 0x0e, 0x96, 0xd0, 0x36, 0x50, + 0x09, 0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 0xbf, + 0x45, 0x02, 0x65, 0x6c, 0x4c, 0x83, 0x8a, 0x62, 0x18, 0xf3, 0x5f, 0x85, 0x4d, 0xab, 0xb6, 0xf7, + 0xe2, 0xb8, 0xa8, 0x1d, 0x1d, 0x17, 0xb5, 0x7f, 0x8e, 0x8b, 0xda, 0x77, 0x27, 0xc5, 0x99, 0xa3, + 0x93, 0xe2, 0xcc, 0x5f, 0x27, 0xc5, 0x99, 0xcf, 0xed, 0x58, 0xf7, 0x0b, 0x1d, 0xf3, 0x6f, 0xf0, + 0x16, 0xe9, 0xd8, 0xad, 0xb6, 0x8b, 0xb0, 0x3d, 0xb8, 0x6f, 0x3f, 0x8b, 0xfe, 0xa9, 0xe0, 0xad, + 0xb0, 0x99, 0xe5, 0x88, 0xfb, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x50, 0x74, 0xfe, 0x7d, 0x0d, 0x00, 0x00, } From 3acf76508ddb6309c86660c8cb8c8763b366aa7a Mon Sep 17 00:00:00 2001 From: Kitipong Sirirueangsakul Date: Tue, 19 Nov 2024 00:18:11 +0700 Subject: [PATCH 5/5] cleanup --- x/tunnel/client/cli/util_test.go | 1 - x/tunnel/keeper/keeper.go | 2 +- .../{keeper_latest_signal_prices.go => keeper_latest_prices.go} | 0 ...atest_signal_prices_test.go => keeper_latest_prices_test.go} | 0 4 files changed, 1 insertion(+), 2 deletions(-) rename x/tunnel/keeper/{keeper_latest_signal_prices.go => keeper_latest_prices.go} (100%) rename x/tunnel/keeper/{keeper_latest_signal_prices_test.go => keeper_latest_prices_test.go} (100%) diff --git a/x/tunnel/client/cli/util_test.go b/x/tunnel/client/cli/util_test.go index 809ddcddb..c24a63731 100644 --- a/x/tunnel/client/cli/util_test.go +++ b/x/tunnel/client/cli/util_test.go @@ -17,7 +17,6 @@ func TestParseSignalDeviations(t *testing.T) { defer cleanup() result, err := parseSignalDeviations(file) - require.NoError(t, err) require.Equal(t, signalDeviations, result.SignalDeviations) } diff --git a/x/tunnel/keeper/keeper.go b/x/tunnel/keeper/keeper.go index b402a2303..bf1ac1cee 100644 --- a/x/tunnel/keeper/keeper.go +++ b/x/tunnel/keeper/keeper.go @@ -42,7 +42,7 @@ func NewKeeper( // ensure that authority is a valid AccAddress if _, err := sdk.AccAddressFromBech32(authority); err != nil { - panic(fmt.Errorf("invalid bandtss authority address: %w", err)) + panic(fmt.Errorf("invalid authority address: %w", err)) } return Keeper{ diff --git a/x/tunnel/keeper/keeper_latest_signal_prices.go b/x/tunnel/keeper/keeper_latest_prices.go similarity index 100% rename from x/tunnel/keeper/keeper_latest_signal_prices.go rename to x/tunnel/keeper/keeper_latest_prices.go diff --git a/x/tunnel/keeper/keeper_latest_signal_prices_test.go b/x/tunnel/keeper/keeper_latest_prices_test.go similarity index 100% rename from x/tunnel/keeper/keeper_latest_signal_prices_test.go rename to x/tunnel/keeper/keeper_latest_prices_test.go