From cbae35e2a0d1def8153179508f73a5696e4661a6 Mon Sep 17 00:00:00 2001 From: Ismail Khoffi Date: Thu, 31 Aug 2023 10:31:54 +0200 Subject: [PATCH] Draft changes to be able to add a start-time in the future for a continuous vesting acct --- api/cosmos/vesting/v1beta1/tx.pulsar.go | 241 ++++++++++++------- proto/cosmos/vesting/v1beta1/tx.proto | 2 + x/auth/vesting/client/cli/tx.go | 10 +- x/auth/vesting/fuzz_test.go | 2 + x/auth/vesting/msg_server.go | 10 +- x/auth/vesting/msg_server_test.go | 21 +- x/auth/vesting/types/msgs.go | 3 +- x/auth/vesting/types/tx.pb.go | 118 ++++++--- x/auth/vesting/types/vesting_account_test.go | 30 +++ 9 files changed, 302 insertions(+), 135 deletions(-) diff --git a/api/cosmos/vesting/v1beta1/tx.pulsar.go b/api/cosmos/vesting/v1beta1/tx.pulsar.go index 3b6e23692bf3..1b2f5e15eb20 100644 --- a/api/cosmos/vesting/v1beta1/tx.pulsar.go +++ b/api/cosmos/vesting/v1beta1/tx.pulsar.go @@ -75,6 +75,7 @@ var ( fd_MsgCreateVestingAccount_amount protoreflect.FieldDescriptor fd_MsgCreateVestingAccount_end_time protoreflect.FieldDescriptor fd_MsgCreateVestingAccount_delayed protoreflect.FieldDescriptor + fd_MsgCreateVestingAccount_start_time protoreflect.FieldDescriptor ) func init() { @@ -85,6 +86,7 @@ func init() { fd_MsgCreateVestingAccount_amount = md_MsgCreateVestingAccount.Fields().ByName("amount") fd_MsgCreateVestingAccount_end_time = md_MsgCreateVestingAccount.Fields().ByName("end_time") fd_MsgCreateVestingAccount_delayed = md_MsgCreateVestingAccount.Fields().ByName("delayed") + fd_MsgCreateVestingAccount_start_time = md_MsgCreateVestingAccount.Fields().ByName("start_time") } var _ protoreflect.Message = (*fastReflection_MsgCreateVestingAccount)(nil) @@ -182,6 +184,12 @@ func (x *fastReflection_MsgCreateVestingAccount) Range(f func(protoreflect.Field return } } + if x.StartTime != int64(0) { + value := protoreflect.ValueOfInt64(x.StartTime) + if !f(fd_MsgCreateVestingAccount_start_time, value) { + return + } + } } // Has reports whether a field is populated. @@ -207,6 +215,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Has(fd protoreflect.FieldDescri return x.EndTime != int64(0) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": return x.Delayed != false + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.start_time": + return x.StartTime != int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -233,6 +243,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Clear(fd protoreflect.FieldDesc x.EndTime = int64(0) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": x.Delayed = false + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.start_time": + x.StartTime = int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -267,6 +279,9 @@ func (x *fastReflection_MsgCreateVestingAccount) Get(descriptor protoreflect.Fie case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": value := x.Delayed return protoreflect.ValueOfBool(value) + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.start_time": + value := x.StartTime + return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -299,6 +314,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Set(fd protoreflect.FieldDescri x.EndTime = value.Int() case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": x.Delayed = value.Bool() + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.start_time": + x.StartTime = value.Int() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -333,6 +350,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Mutable(fd protoreflect.FieldDe panic(fmt.Errorf("field end_time of message cosmos.vesting.v1beta1.MsgCreateVestingAccount is not mutable")) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": panic(fmt.Errorf("field delayed of message cosmos.vesting.v1beta1.MsgCreateVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.start_time": + panic(fmt.Errorf("field start_time of message cosmos.vesting.v1beta1.MsgCreateVestingAccount is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -357,6 +376,8 @@ func (x *fastReflection_MsgCreateVestingAccount) NewField(fd protoreflect.FieldD return protoreflect.ValueOfInt64(int64(0)) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": return protoreflect.ValueOfBool(false) + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.start_time": + return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -446,6 +467,9 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth if x.Delayed { n += 2 } + if x.StartTime != 0 { + n += 1 + runtime.Sov(uint64(x.StartTime)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -475,6 +499,11 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.StartTime != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.StartTime)) + i-- + dAtA[i] = 0x30 + } if x.Delayed { i-- if x.Delayed { @@ -706,6 +735,25 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth } } x.Delayed = bool(v != 0) + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + x.StartTime = 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.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3127,6 +3175,8 @@ type MsgCreateVestingAccount struct { // end of vesting as unix time (in seconds). EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` + // start of vesting as unix time (in seconds). + StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` } func (x *MsgCreateVestingAccount) Reset() { @@ -3184,6 +3234,13 @@ func (x *MsgCreateVestingAccount) GetDelayed() bool { return false } +func (x *MsgCreateVestingAccount) GetStartTime() int64 { + if x != nil { + return x.StartTime + } + return 0 +} + // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. type MsgCreateVestingAccountResponse struct { state protoimpl.MessageState @@ -3405,7 +3462,7 @@ var file_cosmos_vesting_v1beta1_tx_proto_rawDesc = []byte{ 0x61, 0x31, 0x2f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, - 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x02, 0x0a, + 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9c, 0x03, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, @@ -3425,100 +3482,102 @@ var file_cosmos_vesting_v1beta1_tx_proto_rawDesc = []byte{ 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x3a, 0x3c, - 0xe8, 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x21, 0x0a, 0x1f, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0xcf, 0x02, 0x0a, 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x12, 0x1d, + 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x3a, 0x3c, 0xe8, + 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x21, 0x0a, 0x1f, 0x4d, + 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcf, + 0x02, 0x0a, 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, + 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xf2, 0xde, 0x1f, 0x13, 0x79, 0x61, + 0x6d, 0x6c, 0x3a, 0x22, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x22, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, + 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x15, 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x74, 0x6f, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 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, + 0x46, 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, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, + 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, + 0x3f, 0xe8, 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x65, 0x72, 0x6d, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xf2, 0xde, 0x1f, 0x13, 0x79, - 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x34, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x15, 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x74, - 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 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, 0x46, 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, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, - 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x65, 0x72, 0x6d, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, - 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x97, 0x02, 0x0a, - 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, - 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, - 0x69, 0x6f, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, - 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, - 0x72, 0x69, 0x6f, 0x64, 0x73, 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, - 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, - 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x56, 0x65, 0x73, 0x74, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xc5, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x80, 0x01, 0x0a, 0x14, 0x43, 0x72, + 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x97, 0x02, 0x0a, 0x1f, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, + 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x52, 0x0a, 0x0f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, + 0x6f, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, + 0x69, 0x6f, 0x64, 0x73, 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, + 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x56, 0x65, 0x73, 0x74, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xc5, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x80, 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, + 0x6e, 0x74, 0x1a, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x1a, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, - 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, - 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, - 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, - 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xd7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, - 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x76, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x56, - 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x3a, 0x3a, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x1c, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, + 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, + 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, + 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xd7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x76, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x56, 0x58, + 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 67008724c4d1..899803a3fd78 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -49,6 +49,8 @@ message MsgCreateVestingAccount { // end of vesting as unix time (in seconds). int64 end_time = 4; bool delayed = 5; + // start of vesting as unix time (in seconds). + int64 start_time = 6; } // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. diff --git a/x/auth/vesting/client/cli/tx.go b/x/auth/vesting/client/cli/tx.go index fe6a0c341f21..1941203802ff 100644 --- a/x/auth/vesting/client/cli/tx.go +++ b/x/auth/vesting/client/cli/tx.go @@ -20,7 +20,8 @@ import ( // Transaction command flags const ( - FlagDelayed = "delayed" + FlagDelayed = "delayed" + FlagStartTime = "start-time" ) // GetTxCmd returns vesting module's transaction commands. @@ -79,13 +80,18 @@ timestamp.`, } delayed, _ := cmd.Flags().GetBool(FlagDelayed) + startTime, err := cmd.Flags().GetInt64(FlagStartTime) + if err != nil { + return err + } - msg := types.NewMsgCreateVestingAccount(clientCtx.GetFromAddress(), toAddr, amount, endTime, delayed) + msg := types.NewMsgCreateVestingAccount(clientCtx.GetFromAddress(), toAddr, amount, startTime, endTime, delayed) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } cmd.Flags().Bool(FlagDelayed, false, "Create a delayed vesting account if true") + cmd.Flags().Int64(FlagStartTime, 0, "Optional start time (as a UNIX epoch timestamp) for continuous vesting accounts. If 0 (default), the block's time of the block this tx is committed to will be used.") flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/x/auth/vesting/fuzz_test.go b/x/auth/vesting/fuzz_test.go index 4406ef647e55..7e9de63214a2 100644 --- a/x/auth/vesting/fuzz_test.go +++ b/x/auth/vesting/fuzz_test.go @@ -52,6 +52,7 @@ func FuzzMsgServerCreateVestingAccount(f *testing.F) { to2Addr, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, true, ), vestingtypes.NewMsgCreateVestingAccount( @@ -59,6 +60,7 @@ func FuzzMsgServerCreateVestingAccount(f *testing.F) { to3Addr, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, false, ), } diff --git a/x/auth/vesting/msg_server.go b/x/auth/vesting/msg_server.go index 3b18a7d54bec..45939b4b0fce 100644 --- a/x/auth/vesting/msg_server.go +++ b/x/auth/vesting/msg_server.go @@ -47,6 +47,10 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid end time") } + if msg.EndTime <= msg.StartTime { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid start and end time (must be start < end)") + } + ctx := sdk.UnwrapSDKContext(goCtx) if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil { return nil, err @@ -71,7 +75,11 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre if msg.Delayed { vestingAccount = types.NewDelayedVestingAccountRaw(baseVestingAccount) } else { - vestingAccount = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) + start := ctx.BlockTime().Unix() + if msg.StartTime != 0 { + start = msg.StartTime + } + vestingAccount = types.NewContinuousVestingAccountRaw(baseVestingAccount, start) } s.AccountKeeper.SetAccount(ctx, vestingAccount) diff --git a/x/auth/vesting/msg_server_test.go b/x/auth/vesting/msg_server_test.go index 7ca30a1a7f91..42cc46f498d2 100644 --- a/x/auth/vesting/msg_server_test.go +++ b/x/auth/vesting/msg_server_test.go @@ -81,6 +81,7 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { to1Addr, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, true, ), expErr: true, @@ -92,6 +93,7 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { []byte{}, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, true, ), expErr: true, @@ -103,6 +105,7 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { to1Addr, sdk.Coins{sdk.Coin{Denom: "stake", Amount: math.NewInt(-1)}}, time.Now().Unix(), + time.Now().Unix()+1, true, ), expErr: true, @@ -113,12 +116,25 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { fromAddr, to1Addr, sdk.Coins{fooCoin}, + time.Now().Unix(), -10, - true, + false, ), expErr: true, expErrMsg: "invalid end time", }, + "invalid start/end time": { + input: vestingtypes.NewMsgCreateVestingAccount( + fromAddr, + to1Addr, + sdk.Coins{fooCoin}, + time.Now().Unix()+1, + time.Now().Unix(), + true, + ), + expErr: true, + expErrMsg: "invalid start and end time (must be start < end)", + }, "create for existing account": { preRun: func() { toAcc := s.accountKeeper.NewAccountWithAddress(s.ctx, to1Addr) @@ -131,6 +147,7 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { to1Addr, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, true, ), expErr: true, @@ -147,6 +164,7 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { to2Addr, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, true, ), expErr: false, @@ -163,6 +181,7 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { to3Addr, sdk.Coins{fooCoin}, time.Now().Unix(), + time.Now().Unix()+1, false, ), expErr: false, diff --git a/x/auth/vesting/types/msgs.go b/x/auth/vesting/types/msgs.go index 296fa8845921..f973abc98df9 100644 --- a/x/auth/vesting/types/msgs.go +++ b/x/auth/vesting/types/msgs.go @@ -11,11 +11,12 @@ var ( ) // NewMsgCreateVestingAccount returns a reference to a new MsgCreateVestingAccount. -func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, delayed bool) *MsgCreateVestingAccount { +func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, startTime, endTime int64, delayed bool) *MsgCreateVestingAccount { return &MsgCreateVestingAccount{ FromAddress: fromAddr.String(), ToAddress: toAddr.String(), Amount: amount, + StartTime: startTime, EndTime: endTime, Delayed: delayed, } diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go index 2d46bb32daca..2fc268a3f6c5 100644 --- a/x/auth/vesting/types/tx.pb.go +++ b/x/auth/vesting/types/tx.pb.go @@ -42,6 +42,8 @@ type MsgCreateVestingAccount struct { // end of vesting as unix time (in seconds). EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` + // start of vesting as unix time (in seconds). + StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` } func (m *MsgCreateVestingAccount) Reset() { *m = MsgCreateVestingAccount{} } @@ -112,6 +114,13 @@ func (m *MsgCreateVestingAccount) GetDelayed() bool { return false } +func (m *MsgCreateVestingAccount) GetStartTime() int64 { + if m != nil { + return m.StartTime + } + return 0 +} + // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. type MsgCreateVestingAccountResponse struct { } @@ -381,49 +390,50 @@ func init() { func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } var fileDescriptor_5338ca97811f9792 = []byte{ - // 670 bytes of a gzipped FileDescriptorProto + // 676 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0xbf, 0x6f, 0xd3, 0x40, 0x14, 0xc7, 0xe3, 0xba, 0xbf, 0x72, 0xad, 0x40, 0x35, 0x85, 0xba, 0x11, 0xb5, 0x53, 0x0b, 0x44, 0xa8, 0x54, 0x5b, 0x2d, 0x48, 0x95, 0x02, 0x52, 0xd5, 0x54, 0x62, 0x81, 0x4a, 0xc8, 0x20, 0x06, 0x96, 0xe8, 0x62, 0x1f, 0xae, 0xd5, 0xda, 0x17, 0xf9, 0xae, 0x55, 0xb3, 0x55, 0x8c, 0x4c, 0x6c, - 0x20, 0x26, 0x46, 0xc4, 0xd4, 0x81, 0x7f, 0x01, 0xa9, 0x1b, 0x15, 0x13, 0x53, 0x40, 0xc9, 0x10, - 0xe6, 0xee, 0x48, 0xe8, 0x7c, 0xe7, 0x90, 0x14, 0x3b, 0x69, 0x99, 0x58, 0xe2, 0xf8, 0xde, 0xf7, - 0xfb, 0xee, 0xf9, 0xf3, 0xee, 0xd9, 0x40, 0x77, 0x30, 0x09, 0x30, 0xb1, 0xf6, 0x11, 0xa1, 0x7e, - 0xe8, 0x59, 0xfb, 0x2b, 0x35, 0x44, 0xe1, 0x8a, 0x45, 0x0f, 0xcc, 0x7a, 0x84, 0x29, 0x56, 0xae, - 0x71, 0x81, 0x29, 0x04, 0xa6, 0x10, 0x14, 0x66, 0x3d, 0xec, 0xe1, 0x58, 0x62, 0xb1, 0x7f, 0x5c, - 0x5d, 0xd0, 0x44, 0xba, 0x1a, 0x24, 0xa8, 0x9b, 0xcb, 0xc1, 0x7e, 0x28, 0xe2, 0xf3, 0x3c, 0x5e, - 0xe5, 0x46, 0x91, 0x9a, 0x87, 0x6e, 0x64, 0x54, 0x92, 0x6c, 0xcc, 0x55, 0x73, 0x42, 0x15, 0x10, - 0xa6, 0x60, 0x17, 0x11, 0x98, 0x81, 0x81, 0x1f, 0x62, 0x2b, 0xfe, 0xe5, 0x4b, 0xc6, 0xaf, 0x11, - 0x30, 0xb7, 0x45, 0xbc, 0xcd, 0x08, 0x41, 0x8a, 0x9e, 0xf1, 0x34, 0x1b, 0x8e, 0x83, 0xf7, 0x42, - 0xaa, 0xdc, 0x03, 0xd3, 0x2f, 0x22, 0x1c, 0x54, 0xa1, 0xeb, 0x46, 0x88, 0x10, 0x55, 0x2a, 0x4a, - 0xa5, 0x7c, 0x45, 0xfd, 0xfa, 0x69, 0x79, 0x56, 0x54, 0xb5, 0xc1, 0x23, 0x4f, 0x68, 0xe4, 0x87, - 0x9e, 0x3d, 0xc5, 0xd4, 0x62, 0x49, 0x59, 0x03, 0x80, 0xe2, 0xae, 0x75, 0x64, 0x88, 0x35, 0x4f, - 0x71, 0x62, 0x6c, 0x80, 0x71, 0x18, 0xb0, 0xfd, 0x55, 0xb9, 0x28, 0x97, 0xa6, 0x56, 0xe7, 0x4d, - 0xe1, 0x60, 0xbc, 0x12, 0xb4, 0xe6, 0x26, 0xf6, 0xc3, 0xca, 0x83, 0xe3, 0xa6, 0x9e, 0xfb, 0xf8, - 0x5d, 0x2f, 0x79, 0x3e, 0xdd, 0xde, 0xab, 0x99, 0x0e, 0x0e, 0x04, 0x2f, 0x71, 0x59, 0x26, 0xee, - 0x8e, 0x45, 0x1b, 0x75, 0x44, 0x62, 0x03, 0x79, 0xd7, 0x39, 0x5a, 0x9a, 0xde, 0x45, 0x1e, 0x74, - 0x1a, 0x55, 0x46, 0x9c, 0x7c, 0xe8, 0x1c, 0x2d, 0x49, 0xb6, 0xd8, 0x50, 0x99, 0x07, 0x93, 0x28, - 0x74, 0xab, 0xd4, 0x0f, 0x90, 0x3a, 0x5a, 0x94, 0x4a, 0xb2, 0x3d, 0x81, 0x42, 0xf7, 0xa9, 0x1f, - 0x20, 0x45, 0x05, 0x13, 0x2e, 0xda, 0x85, 0x0d, 0xe4, 0xaa, 0x63, 0x45, 0xa9, 0x34, 0x69, 0x27, - 0xb7, 0xe5, 0xfb, 0x3f, 0xdf, 0xeb, 0xd2, 0x4b, 0x96, 0xb8, 0x17, 0xd6, 0xab, 0xce, 0xd1, 0x92, - 0xd1, 0x53, 0x44, 0x06, 0x63, 0x63, 0x11, 0xe8, 0x19, 0x21, 0x1b, 0x91, 0x3a, 0x0e, 0x09, 0x32, - 0xbe, 0x8c, 0xf4, 0x68, 0x1e, 0xa3, 0x28, 0x80, 0x21, 0x0a, 0xe9, 0x23, 0xec, 0xec, 0x20, 0x37, - 0x69, 0x55, 0x39, 0xb5, 0x55, 0x73, 0xa7, 0x4d, 0xfd, 0x4a, 0x03, 0x06, 0xbb, 0x65, 0xa3, 0x37, - 0x6a, 0xf4, 0x77, 0xea, 0x6e, 0x4a, 0xa7, 0xae, 0x9e, 0x36, 0xf5, 0x19, 0xee, 0xfc, 0x13, 0x33, - 0xfe, 0x8f, 0x36, 0x95, 0xd7, 0x33, 0x89, 0xdf, 0x4c, 0x23, 0xce, 0x90, 0xf5, 0xd1, 0x32, 0x6e, - 0x83, 0x5b, 0x43, 0x80, 0x76, 0xe1, 0xbf, 0x39, 0x03, 0xdf, 0xc7, 0xae, 0xef, 0x9c, 0x99, 0x93, - 0xc5, 0x34, 0xf8, 0xfd, 0x8c, 0x17, 0xfe, 0x66, 0xdc, 0x0b, 0x73, 0x01, 0x00, 0x42, 0x61, 0x44, - 0xf9, 0xd1, 0x93, 0xe3, 0xa3, 0x97, 0x8f, 0x57, 0xe2, 0xc3, 0x67, 0x83, 0xcb, 0x62, 0xc2, 0xab, - 0xf5, 0xb8, 0x04, 0xa2, 0x8e, 0xc6, 0xd0, 0x35, 0x33, 0xfd, 0xcd, 0x63, 0xf2, 0x4a, 0x2b, 0x79, - 0x46, 0x9e, 0xc3, 0xbb, 0x24, 0x24, 0x3c, 0x42, 0x62, 0x88, 0xb9, 0x0b, 0x41, 0xf4, 0xb1, 0xcb, - 0x1e, 0x3c, 0x03, 0x62, 0x0a, 0x98, 0x04, 0xe2, 0xea, 0x67, 0x19, 0xc8, 0x5b, 0xc4, 0x53, 0x0e, - 0x25, 0x30, 0x9b, 0xfa, 0xa6, 0xb1, 0xb2, 0x9e, 0x23, 0x63, 0x36, 0x0a, 0x6b, 0x17, 0x34, 0x24, - 0xa5, 0x28, 0x6f, 0x25, 0x70, 0x7d, 0xe0, 0x24, 0x0d, 0xcf, 0x9c, 0x6e, 0x2c, 0xac, 0xff, 0xa3, - 0x31, 0xbd, 0xb4, 0xb4, 0x73, 0x76, 0xae, 0xd2, 0x52, 0x8c, 0xe7, 0x2b, 0x6d, 0x40, 0x03, 0x0b, - 0x63, 0x87, 0xec, 0x0c, 0x55, 0x1e, 0x1e, 0xb7, 0x34, 0xe9, 0xa4, 0xa5, 0x49, 0x3f, 0x5a, 0x9a, - 0xf4, 0xba, 0xad, 0xe5, 0x4e, 0xda, 0x5a, 0xee, 0x5b, 0x5b, 0xcb, 0x3d, 0x5f, 0x19, 0x38, 0xda, - 0x07, 0x16, 0xdc, 0xa3, 0xdb, 0xdd, 0xaf, 0x56, 0x3c, 0xe9, 0xb5, 0xf1, 0xf8, 0x03, 0x74, 0xe7, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x64, 0x77, 0xbb, 0x5e, 0x07, 0x00, 0x00, + 0x20, 0xc4, 0xc0, 0x88, 0x98, 0x3a, 0xf0, 0x2f, 0x20, 0x75, 0xa3, 0x62, 0x62, 0x2a, 0x28, 0x19, + 0xc2, 0xdc, 0xbf, 0x00, 0x9d, 0xef, 0x1c, 0x92, 0x60, 0x27, 0x2d, 0x13, 0x4b, 0xdd, 0xdc, 0xfb, + 0x7e, 0xdf, 0x3d, 0x7f, 0xde, 0xbd, 0x33, 0xd0, 0x1d, 0x4c, 0x02, 0x4c, 0xac, 0x7d, 0x44, 0xa8, + 0x1f, 0x7a, 0xd6, 0xfe, 0x4a, 0x0d, 0x51, 0xb8, 0x62, 0xd1, 0x03, 0xb3, 0x1e, 0x61, 0x8a, 0x95, + 0x6b, 0x5c, 0x60, 0x0a, 0x81, 0x29, 0x04, 0x85, 0x59, 0x0f, 0x7b, 0x38, 0x96, 0x58, 0xec, 0x3f, + 0xae, 0x2e, 0x68, 0x22, 0x5d, 0x0d, 0x12, 0xd4, 0xc9, 0xe5, 0x60, 0x3f, 0x14, 0xf1, 0x79, 0x1e, + 0xaf, 0x72, 0xa3, 0x48, 0xcd, 0x43, 0x37, 0x32, 0x2a, 0x49, 0x36, 0xe6, 0xaa, 0x39, 0xa1, 0x0a, + 0x08, 0x53, 0xb0, 0x87, 0x08, 0xcc, 0xc0, 0xc0, 0x0f, 0xb1, 0x15, 0xff, 0xe5, 0x4b, 0xc6, 0x7b, + 0x19, 0xcc, 0x6d, 0x11, 0x6f, 0x33, 0x42, 0x90, 0xa2, 0x67, 0x3c, 0xcd, 0x86, 0xe3, 0xe0, 0xbd, + 0x90, 0x2a, 0xf7, 0xc0, 0xf4, 0x8b, 0x08, 0x07, 0x55, 0xe8, 0xba, 0x11, 0x22, 0x44, 0x95, 0x8a, + 0x52, 0x29, 0x5f, 0x51, 0xbf, 0x7d, 0x5e, 0x9e, 0x15, 0x55, 0x6d, 0xf0, 0xc8, 0x13, 0x1a, 0xf9, + 0xa1, 0x67, 0x4f, 0x31, 0xb5, 0x58, 0x52, 0xd6, 0x00, 0xa0, 0xb8, 0x63, 0x1d, 0x19, 0x62, 0xcd, + 0x53, 0x9c, 0x18, 0x1b, 0x60, 0x1c, 0x06, 0x6c, 0x7f, 0x55, 0x2e, 0xca, 0xa5, 0xa9, 0xd5, 0x79, + 0x53, 0x38, 0x18, 0xaf, 0x04, 0xad, 0xb9, 0x89, 0xfd, 0xb0, 0xf2, 0xe0, 0xf8, 0x54, 0xcf, 0x7d, + 0xfa, 0xa1, 0x97, 0x3c, 0x9f, 0x6e, 0xef, 0xd5, 0x4c, 0x07, 0x07, 0x82, 0x97, 0x78, 0x2c, 0x13, + 0x77, 0xc7, 0xa2, 0x8d, 0x3a, 0x22, 0xb1, 0x81, 0xbc, 0x6b, 0x1f, 0x2d, 0x4d, 0xef, 0x22, 0x0f, + 0x3a, 0x8d, 0x2a, 0x23, 0x4e, 0x3e, 0xb6, 0x8f, 0x96, 0x24, 0x5b, 0x6c, 0xa8, 0xcc, 0x83, 0x49, + 0x14, 0xba, 0x55, 0xea, 0x07, 0x48, 0x1d, 0x2d, 0x4a, 0x25, 0xd9, 0x9e, 0x40, 0xa1, 0xfb, 0xd4, + 0x0f, 0x90, 0xa2, 0x82, 0x09, 0x17, 0xed, 0xc2, 0x06, 0x72, 0xd5, 0xb1, 0xa2, 0x54, 0x9a, 0xb4, + 0x93, 0x9f, 0xca, 0x02, 0x00, 0x84, 0xc2, 0x88, 0x72, 0xdb, 0x78, 0x6c, 0xcb, 0xc7, 0x2b, 0xcc, + 0x58, 0xbe, 0xff, 0xeb, 0x83, 0x2e, 0xbd, 0x64, 0xfb, 0x76, 0xb3, 0x7c, 0xd5, 0x3e, 0x5a, 0x32, + 0xba, 0x6a, 0xcc, 0x68, 0x81, 0xb1, 0x08, 0xf4, 0x8c, 0x90, 0x8d, 0x48, 0x1d, 0x87, 0x04, 0x19, + 0x5f, 0x47, 0xba, 0x34, 0x8f, 0x51, 0x14, 0xc0, 0x10, 0x85, 0xf4, 0x11, 0x76, 0x76, 0x90, 0x9b, + 0x74, 0xb2, 0x9c, 0xda, 0xc9, 0xb9, 0xb3, 0x53, 0xfd, 0x4a, 0x03, 0x06, 0xbb, 0x65, 0xa3, 0x3b, + 0x6a, 0xf4, 0x36, 0xf2, 0x6e, 0x4a, 0x23, 0xaf, 0x9e, 0x9d, 0xea, 0x33, 0xdc, 0xf9, 0x27, 0x66, + 0xfc, 0x1f, 0x5d, 0x2c, 0xaf, 0x67, 0x12, 0xbf, 0x99, 0x46, 0x9c, 0x21, 0xeb, 0xa1, 0x65, 0xdc, + 0x06, 0xb7, 0x86, 0x00, 0xed, 0xc0, 0x7f, 0xd3, 0x07, 0xdf, 0xc7, 0xae, 0xef, 0xf4, 0x8d, 0xd1, + 0x62, 0x1a, 0xfc, 0x5e, 0xc6, 0x0b, 0x7f, 0x33, 0xee, 0x86, 0xd9, 0x7b, 0xc4, 0xe4, 0xbe, 0x23, + 0xa6, 0xd8, 0xe0, 0xb2, 0xb8, 0x00, 0xaa, 0xf5, 0xb8, 0x04, 0xa2, 0x8e, 0xc6, 0xd0, 0x35, 0x33, + 0xfd, 0x62, 0x32, 0x79, 0xa5, 0x95, 0x3c, 0x23, 0xcf, 0xe1, 0x5d, 0x12, 0x12, 0x1e, 0x21, 0x31, + 0xc4, 0xdc, 0x85, 0x20, 0xfa, 0xd8, 0x65, 0x2f, 0x9e, 0x01, 0x31, 0x05, 0x4c, 0x02, 0x71, 0xf5, + 0x8b, 0x0c, 0xe4, 0x2d, 0xe2, 0x29, 0x87, 0x12, 0x98, 0x4d, 0xbd, 0x88, 0xac, 0xac, 0xf7, 0xc8, + 0x98, 0x8d, 0xc2, 0xda, 0x05, 0x0d, 0x49, 0x29, 0xca, 0x5b, 0x09, 0x5c, 0x1f, 0x38, 0x49, 0xc3, + 0x33, 0xa7, 0x1b, 0x0b, 0xeb, 0xff, 0x68, 0x4c, 0x2f, 0x2d, 0xed, 0x9c, 0x9d, 0xab, 0xb4, 0x14, + 0xe3, 0xf9, 0x4a, 0x1b, 0xd0, 0xc0, 0xc2, 0xd8, 0x21, 0x3b, 0x43, 0x95, 0x87, 0xc7, 0x4d, 0x4d, + 0x3a, 0x69, 0x6a, 0xd2, 0xcf, 0xa6, 0x26, 0xbd, 0x6e, 0x69, 0xb9, 0x93, 0x96, 0x96, 0xfb, 0xde, + 0xd2, 0x72, 0xcf, 0x57, 0x06, 0x8e, 0xf6, 0x81, 0x05, 0xf7, 0xe8, 0x76, 0xe7, 0xa3, 0x16, 0x4f, + 0x7a, 0x6d, 0x3c, 0xfe, 0x3e, 0xdd, 0xf9, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xab, 0x5c, 0x40, + 0x7d, 0x07, 0x00, 0x00, } func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { @@ -465,6 +475,9 @@ func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { if this.Delayed != that1.Delayed { return false } + if this.StartTime != that1.StartTime { + return false + } return true } func (this *MsgCreatePermanentLockedAccount) Equal(that interface{}) bool { @@ -695,6 +708,11 @@ func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.StartTime != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StartTime)) + i-- + dAtA[i] = 0x30 + } if m.Delayed { i-- if m.Delayed { @@ -954,6 +972,9 @@ func (m *MsgCreateVestingAccount) Size() (n int) { if m.Delayed { n += 2 } + if m.StartTime != 0 { + n += 1 + sovTx(uint64(m.StartTime)) + } return n } @@ -1205,6 +1226,25 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } } m.Delayed = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 74cdfe59c5a5..0408c8bd4680 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -111,6 +111,36 @@ func TestGetVestingCoinsContVestingAcc(t *testing.T) { require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) } +func TestGetVestingCoinsContVestingAccStartTimeInFuture(t *testing.T) { + now := tmtime.Now() + startTime := now.Add(24 * time.Hour) + endTime := startTime.Add(24 * time.Hour) + + bacc, origCoins := initBaseAccount() + cva, err := types.NewContinuousVestingAccount(bacc, origCoins, startTime.Unix(), endTime.Unix()) + require.NoError(t, err) + + // require all coins vesting in the beginning of the vesting schedule + vestingCoins := cva.GetVestingCoins(now) + require.Equal(t, origCoins, vestingCoins) + + // require all coins vesting before right start time of the vesting schedule + vestingCoins = cva.GetVestingCoins(startTime.Add(-1)) + require.Equal(t, origCoins, vestingCoins) + + // require no coins vesting at the end of the vesting schedule + vestingCoins = cva.GetVestingCoins(endTime) + require.Equal(t, emptyCoins, vestingCoins) + + // require 50% of coins vesting + vestingCoins = cva.GetVestingCoins(startTime.Add(12 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) + + // require 50% of coins spendable + vestingCoins = cva.GetVestedCoins(startTime.Add(12 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) +} + func TestSpendableCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour)