From 5fdcff42c5405c6e2dccd881f24f7eb28947dd1a Mon Sep 17 00:00:00 2001 From: Cory Levinson Date: Thu, 4 Feb 2021 19:34:52 -0800 Subject: [PATCH 01/14] add basics for permanent locked vesting account support --- docs/core/proto-docs.md | 35 ++- proto/cosmos/vesting/v1beta1/tx.proto | 12 +- proto/cosmos/vesting/v1beta1/vesting.proto | 10 + x/auth/vesting/msg_server.go | 8 +- x/auth/vesting/types/msgs.go | 12 +- x/auth/vesting/types/tx.pb.go | 128 ++++++---- x/auth/vesting/types/vesting.pb.go | 257 +++++++++++++++++---- x/auth/vesting/types/vesting_account.go | 65 ++++++ 8 files changed, 426 insertions(+), 101 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index ec30ba730ba1..8d0463abd765 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -494,6 +494,8 @@ - [MsgCreateVestingAccount](#cosmos.vesting.v1beta1.MsgCreateVestingAccount) - [MsgCreateVestingAccountResponse](#cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse) + - [VestingAccountType](#cosmos.vesting.v1beta1.VestingAccountType) + - [Msg](#cosmos.vesting.v1beta1.Msg) - [cosmos/vesting/v1beta1/vesting.proto](#cosmos/vesting/v1beta1/vesting.proto) @@ -502,6 +504,7 @@ - [DelayedVestingAccount](#cosmos.vesting.v1beta1.DelayedVestingAccount) - [Period](#cosmos.vesting.v1beta1.Period) - [PeriodicVestingAccount](#cosmos.vesting.v1beta1.PeriodicVestingAccount) + - [PermanentLockedVestingAccount](#cosmos.vesting.v1beta1.PermanentLockedVestingAccount) - [ibc/applications/transfer/v1/transfer.proto](#ibc/applications/transfer/v1/transfer.proto) - [DenomTrace](#ibc.applications.transfer.v1.DenomTrace) @@ -7175,7 +7178,7 @@ account. | `to_address` | [string](#string) | | | | `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | | `end_time` | [int64](#int64) | | | -| `delayed` | [bool](#bool) | | | +| `vesting_account_type` | [VestingAccountType](#cosmos.vesting.v1beta1.VestingAccountType) | | | @@ -7193,6 +7196,19 @@ MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response ty + + + +### VestingAccountType + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| DELAYED_VESTING_ACCOUNT_TYPE | 0 | | +| CONTINUOUS_VESTING_ACCOUNT_TYPE | 1 | | +| PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE | 2 | | + + @@ -7305,6 +7321,23 @@ periodically vests by unlocking coins during each specified period. + + + +### PermanentLockedVestingAccount +PermanentLockedVestingAccount implements the VestingAccount interface. It does +not ever release coins, locking them indefinitely. Coins in this account can +still be used for delegating and for governance votes even while locked. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `base_vesting_account` | [BaseVestingAccount](#cosmos.vesting.v1beta1.BaseVestingAccount) | | | + + + + + diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index c49be802a76e..4f32c342731e 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -24,8 +24,16 @@ message MsgCreateVestingAccount { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; int64 end_time = 4 [(gogoproto.moretags) = "yaml:\"end_time\""]; - bool delayed = 5; + + VestingAccountType vesting_account_type = 5 [(gogoproto.moretags) = "yaml:\"vesting_account_type\""]; +} + +enum VestingAccountType { + DELAYED_VESTING_ACCOUNT_TYPE = 0; + CONTINUOUS_VESTING_ACCOUNT_TYPE = 1; + PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE = 2; } // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. -message MsgCreateVestingAccountResponse {} \ No newline at end of file +message MsgCreateVestingAccountResponse {} + diff --git a/proto/cosmos/vesting/v1beta1/vesting.proto b/proto/cosmos/vesting/v1beta1/vesting.proto index 6bdbbf08e4de..3cd601b8880c 100644 --- a/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/proto/cosmos/vesting/v1beta1/vesting.proto @@ -52,6 +52,16 @@ message DelayedVestingAccount { BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } +// PermanentLockedVestingAccount implements the VestingAccount interface. It does +// not ever release coins, locking them indefinitely. Coins in this account can +// still be used for delegating and for governance votes even while locked. +message PermanentLockedVestingAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; +} + // Period defines a length of time and amount of coins that will vest. message Period { option (gogoproto.goproto_stringer) = false; diff --git a/x/auth/vesting/msg_server.go b/x/auth/vesting/msg_server.go index dadd65dbcf1c..0173e5df5232 100644 --- a/x/auth/vesting/msg_server.go +++ b/x/auth/vesting/msg_server.go @@ -62,10 +62,14 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre var acc authtypes.AccountI - if msg.Delayed { + if msg.VestingAccountType == types.MsgCreateVestingAccount_CONTINUOUS_VESTING_ACCOUNT { + acc = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) + } else if msg.VestingAccountType == types.MsgCreateVestingAccount_DELAYED_VESTING_ACCOUNT { acc = types.NewDelayedVestingAccountRaw(baseVestingAccount) + } else if msg.VestingAccountType == types.MsgCreateVestingAccount_PERMANENT_LOCKED_VESTING_ACCOUNT { + acc = types.NewPermanentLockedVestingAccountRaw(baseVestingAccount) } else { - acc = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid account type; expected valid VestingAccountType, got: %v", msg.VestingAccountType) } ak.SetAccount(ctx, acc) diff --git a/x/auth/vesting/types/msgs.go b/x/auth/vesting/types/msgs.go index 3308e0304881..b26249cee038 100644 --- a/x/auth/vesting/types/msgs.go +++ b/x/auth/vesting/types/msgs.go @@ -12,13 +12,13 @@ var _ sdk.Msg = &MsgCreateVestingAccount{} // NewMsgCreateVestingAccount returns a reference to a new MsgCreateVestingAccount. //nolint:interfacer -func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, delayed bool) *MsgCreateVestingAccount { +func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, vestingAccountType VestingAccountType) *MsgCreateVestingAccount { return &MsgCreateVestingAccount{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - Amount: amount, - EndTime: endTime, - Delayed: delayed, + FromAddress: fromAddr.String(), + ToAddress: toAddr.String(), + Amount: amount, + EndTime: endTime, + VestingAccountType: vestingAccountType, } } diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go index d07a154dd326..34d118f10c91 100644 --- a/x/auth/vesting/types/tx.pb.go +++ b/x/auth/vesting/types/tx.pb.go @@ -30,14 +30,42 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type VestingAccountType int32 + +const ( + VestingAccountType_DELAYED_VESTING_ACCOUNT_TYPE VestingAccountType = 0 + VestingAccountType_CONTINUOUS_VESTING_ACCOUNT_TYPE VestingAccountType = 1 + VestingAccountType_PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE VestingAccountType = 2 +) + +var VestingAccountType_name = map[int32]string{ + 0: "DELAYED_VESTING_ACCOUNT_TYPE", + 1: "CONTINUOUS_VESTING_ACCOUNT_TYPE", + 2: "PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE", +} + +var VestingAccountType_value = map[string]int32{ + "DELAYED_VESTING_ACCOUNT_TYPE": 0, + "CONTINUOUS_VESTING_ACCOUNT_TYPE": 1, + "PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE": 2, +} + +func (x VestingAccountType) String() string { + return proto.EnumName(VestingAccountType_name, int32(x)) +} + +func (VestingAccountType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{0} +} + // MsgCreateVestingAccount defines a message that enables creating a vesting // account. type MsgCreateVestingAccount struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` - EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty" yaml:"end_time"` - Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty" yaml:"end_time"` + VestingAccountType VestingAccountType `protobuf:"varint,5,opt,name=vesting_account_type,json=vestingAccountType,proto3,enum=cosmos.vesting.v1beta1.VestingAccountType" json:"vesting_account_type,omitempty" yaml:"vesting_account_type"` } func (m *MsgCreateVestingAccount) Reset() { *m = MsgCreateVestingAccount{} } @@ -101,11 +129,11 @@ func (m *MsgCreateVestingAccount) GetEndTime() int64 { return 0 } -func (m *MsgCreateVestingAccount) GetDelayed() bool { +func (m *MsgCreateVestingAccount) GetVestingAccountType() VestingAccountType { if m != nil { - return m.Delayed + return m.VestingAccountType } - return false + return VestingAccountType_DELAYED_VESTING_ACCOUNT_TYPE } // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. @@ -146,6 +174,7 @@ func (m *MsgCreateVestingAccountResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateVestingAccountResponse proto.InternalMessageInfo func init() { + proto.RegisterEnum("cosmos.vesting.v1beta1.VestingAccountType", VestingAccountType_name, VestingAccountType_value) proto.RegisterType((*MsgCreateVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccount") proto.RegisterType((*MsgCreateVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") } @@ -153,33 +182,40 @@ func init() { func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } var fileDescriptor_5338ca97811f9792 = []byte{ - // 410 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xbd, 0xae, 0xd3, 0x30, - 0x14, 0x8e, 0x6f, 0x2e, 0xf7, 0xc7, 0x17, 0x09, 0x91, 0x16, 0x1a, 0x3a, 0xc4, 0x21, 0x53, 0x16, - 0x6c, 0x5a, 0x90, 0x90, 0xba, 0x35, 0x1d, 0x51, 0x97, 0x08, 0x31, 0xb0, 0x54, 0x4e, 0x62, 0xd2, - 0x88, 0x26, 0xae, 0x62, 0xb7, 0x6a, 0x37, 0x46, 0x46, 0x1e, 0x81, 0x99, 0xa7, 0x60, 0xec, 0xd8, - 0x91, 0x29, 0xa0, 0x76, 0x61, 0xee, 0x13, 0xa0, 0xc4, 0x49, 0x61, 0x68, 0x91, 0x98, 0xec, 0xa3, - 0xef, 0xc7, 0xe7, 0x7c, 0x3e, 0x10, 0x85, 0x5c, 0xa4, 0x5c, 0x90, 0x25, 0x13, 0x32, 0xc9, 0x62, - 0xb2, 0xec, 0x05, 0x4c, 0xd2, 0x1e, 0x91, 0x2b, 0x3c, 0xcf, 0xb9, 0xe4, 0xc6, 0x63, 0x45, 0xc0, - 0x35, 0x01, 0xd7, 0x84, 0x6e, 0x3b, 0xe6, 0x31, 0xaf, 0x28, 0xa4, 0xbc, 0x29, 0x76, 0xd7, 0xaa, - 0xed, 0x02, 0x2a, 0xd8, 0xd1, 0x2b, 0xe4, 0x49, 0xa6, 0x70, 0xe7, 0xdb, 0x05, 0xec, 0x8c, 0x45, - 0x3c, 0xca, 0x19, 0x95, 0xec, 0xad, 0xb2, 0x1c, 0x86, 0x21, 0x5f, 0x64, 0xd2, 0x18, 0xc0, 0xfb, - 0xef, 0x73, 0x9e, 0x4e, 0x68, 0x14, 0xe5, 0x4c, 0x08, 0x13, 0xd8, 0xc0, 0xbd, 0xf5, 0x3a, 0x87, - 0x02, 0xb5, 0xd6, 0x34, 0x9d, 0x0d, 0x9c, 0xbf, 0x51, 0xc7, 0xbf, 0x2b, 0xcb, 0xa1, 0xaa, 0x8c, - 0x97, 0x10, 0x4a, 0x7e, 0x54, 0x5e, 0x54, 0xca, 0x47, 0x87, 0x02, 0x3d, 0x54, 0xca, 0x3f, 0x98, - 0xe3, 0xdf, 0x4a, 0xde, 0xa8, 0x42, 0x78, 0x45, 0xd3, 0xf2, 0x6d, 0x53, 0xb7, 0x75, 0xf7, 0xae, - 0xff, 0x04, 0xd7, 0xc3, 0x96, 0xed, 0x37, 0x93, 0xe2, 0x11, 0x4f, 0x32, 0xef, 0xf9, 0xa6, 0x40, - 0xda, 0xd7, 0x1f, 0xc8, 0x8d, 0x13, 0x39, 0x5d, 0x04, 0x38, 0xe4, 0x29, 0xa9, 0x67, 0x55, 0xc7, - 0x33, 0x11, 0x7d, 0x20, 0x72, 0x3d, 0x67, 0xa2, 0x12, 0x08, 0xbf, 0xb6, 0x36, 0x30, 0xbc, 0x61, - 0x59, 0x34, 0x91, 0x49, 0xca, 0xcc, 0x4b, 0x1b, 0xb8, 0xba, 0xd7, 0x3a, 0x14, 0xe8, 0x81, 0x6a, - 0xac, 0x41, 0x1c, 0xff, 0x9a, 0x65, 0xd1, 0x9b, 0x24, 0x65, 0x86, 0x09, 0xaf, 0x23, 0x36, 0xa3, - 0x6b, 0x16, 0x99, 0xf7, 0x6c, 0xe0, 0xde, 0xf8, 0x4d, 0x39, 0xb8, 0xfc, 0xf5, 0x05, 0x01, 0xe7, - 0x29, 0x44, 0x67, 0x12, 0xf4, 0x99, 0x98, 0xf3, 0x4c, 0xb0, 0xfe, 0x27, 0x00, 0xf5, 0xb1, 0x88, - 0x8d, 0x8f, 0x00, 0xb6, 0x4f, 0x46, 0x4d, 0xf0, 0xe9, 0x5f, 0xc5, 0x67, 0x9c, 0xbb, 0xaf, 0xfe, - 0x53, 0xd0, 0xb4, 0xe2, 0xbd, 0xde, 0xec, 0x2c, 0xb0, 0xdd, 0x59, 0xe0, 0xe7, 0xce, 0x02, 0x9f, - 0xf7, 0x96, 0xb6, 0xdd, 0x5b, 0xda, 0xf7, 0xbd, 0xa5, 0xbd, 0xeb, 0xfd, 0x33, 0xc9, 0x15, 0xa1, - 0x0b, 0x39, 0x3d, 0xae, 0x65, 0x15, 0x6c, 0x70, 0x55, 0x2d, 0xd1, 0x8b, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xe7, 0x28, 0xaf, 0xe5, 0xb5, 0x02, 0x00, 0x00, + // 521 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xbf, 0x6f, 0xd3, 0x40, + 0x18, 0xcd, 0x35, 0xa5, 0xd0, 0x2b, 0xe2, 0xc7, 0x35, 0xd0, 0x10, 0x90, 0x2f, 0x18, 0x21, 0x85, + 0x4a, 0xd8, 0x24, 0x20, 0x21, 0x65, 0x4b, 0x5c, 0x0b, 0x55, 0x6d, 0x9c, 0xca, 0x75, 0x2a, 0x95, + 0xc5, 0x72, 0xec, 0xc3, 0xb5, 0xc0, 0xbe, 0x28, 0x77, 0x89, 0x9a, 0x01, 0x89, 0x09, 0x31, 0xf2, + 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0x5b, 0x0d, 0x43, 0x37, + 0x2c, 0x7b, 0xbf, 0xad, 0xed, 0x2d, 0xd3, 0x5b, 0xa9, 0x7d, 0x02, 0x30, 0xdf, 0x62, 0x3e, 0xfa, + 0x00, 0x60, 0x61, 0xe1, 0x60, 0xa9, 0xcb, 0x32, 0x5b, 0x62, 0xb1, 0xf4, 0xf2, 0x92, 0x84, 0x59, + 0x26, 0xcd, 0xbd, 0xb3, 0xb1, 0x04, 0xce, 0xc7, 0x12, 0xf8, 0x39, 0x96, 0xc0, 0xe7, 0x89, 0x94, + 0x3b, 0x9f, 0x48, 0xb9, 0xef, 0x13, 0x29, 0xf7, 0xba, 0xfa, 0xdf, 0xb9, 0x39, 0x55, 0x9d, 0x01, + 0x3f, 0x99, 0x2f, 0x61, 0x3a, 0x46, 0xdd, 0xb5, 0x74, 0x65, 0x9e, 0xff, 0x0e, 0x00, 0x00, 0xff, + 0xff, 0x39, 0x69, 0x73, 0x02, 0xa3, 0x03, 0x00, 0x00, } func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { @@ -218,7 +254,7 @@ func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { if this.EndTime != that1.EndTime { return false } - if this.Delayed != that1.Delayed { + if this.VestingAccountType != that1.VestingAccountType { return false } return true @@ -328,13 +364,8 @@ func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if m.Delayed { - i-- - if m.Delayed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if m.VestingAccountType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VestingAccountType)) i-- dAtA[i] = 0x28 } @@ -431,8 +462,8 @@ func (m *MsgCreateVestingAccount) Size() (n int) { if m.EndTime != 0 { n += 1 + sovTx(uint64(m.EndTime)) } - if m.Delayed { - n += 2 + if m.VestingAccountType != 0 { + n += 1 + sovTx(uint64(m.VestingAccountType)) } return n } @@ -600,9 +631,9 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Delayed", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VestingAccountType", wireType) } - var v int + m.VestingAccountType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -612,12 +643,11 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.VestingAccountType |= VestingAccountType(b&0x7F) << shift if b < 0x80 { break } } - m.Delayed = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/auth/vesting/types/vesting.pb.go b/x/auth/vesting/types/vesting.pb.go index 7672ce66f8e0..fc13dbb7af53 100644 --- a/x/auth/vesting/types/vesting.pb.go +++ b/x/auth/vesting/types/vesting.pb.go @@ -146,6 +146,45 @@ func (m *DelayedVestingAccount) XXX_DiscardUnknown() { var xxx_messageInfo_DelayedVestingAccount proto.InternalMessageInfo +// PermanentLockedVestingAccount implements the VestingAccount interface. It does +// not ever release coins, locking them indefinitely. Coins in this account can +// still be used for delegating and for governance votes even while locked. +type PermanentLockedVestingAccount struct { + *BaseVestingAccount `protobuf:"bytes,1,opt,name=base_vesting_account,json=baseVestingAccount,proto3,embedded=base_vesting_account" json:"base_vesting_account,omitempty"` +} + +func (m *PermanentLockedVestingAccount) Reset() { *m = PermanentLockedVestingAccount{} } +func (*PermanentLockedVestingAccount) ProtoMessage() {} +func (*PermanentLockedVestingAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_89e80273ca606d6e, []int{3} +} +func (m *PermanentLockedVestingAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PermanentLockedVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PermanentLockedVestingAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PermanentLockedVestingAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_PermanentLockedVestingAccount.Merge(m, src) +} +func (m *PermanentLockedVestingAccount) XXX_Size() int { + return m.Size() +} +func (m *PermanentLockedVestingAccount) XXX_DiscardUnknown() { + xxx_messageInfo_PermanentLockedVestingAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_PermanentLockedVestingAccount proto.InternalMessageInfo + // Period defines a length of time and amount of coins that will vest. type Period struct { Length int64 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` @@ -155,7 +194,7 @@ type Period struct { func (m *Period) Reset() { *m = Period{} } func (*Period) ProtoMessage() {} func (*Period) Descriptor() ([]byte, []int) { - return fileDescriptor_89e80273ca606d6e, []int{3} + return fileDescriptor_89e80273ca606d6e, []int{4} } func (m *Period) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -209,7 +248,7 @@ type PeriodicVestingAccount struct { func (m *PeriodicVestingAccount) Reset() { *m = PeriodicVestingAccount{} } func (*PeriodicVestingAccount) ProtoMessage() {} func (*PeriodicVestingAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_89e80273ca606d6e, []int{4} + return fileDescriptor_89e80273ca606d6e, []int{5} } func (m *PeriodicVestingAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -242,6 +281,7 @@ func init() { proto.RegisterType((*BaseVestingAccount)(nil), "cosmos.vesting.v1beta1.BaseVestingAccount") proto.RegisterType((*ContinuousVestingAccount)(nil), "cosmos.vesting.v1beta1.ContinuousVestingAccount") proto.RegisterType((*DelayedVestingAccount)(nil), "cosmos.vesting.v1beta1.DelayedVestingAccount") + proto.RegisterType((*PermanentLockedVestingAccount)(nil), "cosmos.vesting.v1beta1.PermanentLockedVestingAccount") proto.RegisterType((*Period)(nil), "cosmos.vesting.v1beta1.Period") proto.RegisterType((*PeriodicVestingAccount)(nil), "cosmos.vesting.v1beta1.PeriodicVestingAccount") } @@ -251,45 +291,46 @@ func init() { } var fileDescriptor_89e80273ca606d6e = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x7d, 0x49, 0x08, 0xe5, 0x02, 0x4d, 0x6b, 0x9a, 0x60, 0x3a, 0xd8, 0x91, 0xc5, 0x10, - 0x21, 0xe1, 0x90, 0xc2, 0x94, 0x0d, 0x17, 0x21, 0x55, 0x65, 0x40, 0x16, 0x62, 0x60, 0x89, 0xfc, - 0xe3, 0x70, 0x4e, 0xc4, 0xbe, 0xc8, 0x77, 0xa9, 0xc8, 0x1f, 0x80, 0x84, 0xd4, 0x05, 0x24, 0x06, - 0xc6, 0x2e, 0x2c, 0xfc, 0x11, 0xcc, 0x1d, 0x23, 0x26, 0xa6, 0x80, 0x92, 0xff, 0x20, 0x7f, 0x01, - 0xf2, 0xdd, 0xd9, 0x01, 0x17, 0x88, 0xca, 0x80, 0xd4, 0x29, 0x79, 0xf7, 0xde, 0xfb, 0xde, 0xe7, - 0xbd, 0x7b, 0x77, 0x86, 0xb7, 0x7c, 0x42, 0x23, 0x42, 0x3b, 0x47, 0x88, 0x32, 0x1c, 0x87, 0x9d, - 0xa3, 0xae, 0x87, 0x98, 0xdb, 0xcd, 0x6c, 0x6b, 0x94, 0x10, 0x46, 0xd4, 0xa6, 0x88, 0xb2, 0xb2, - 0x55, 0x19, 0xb5, 0xbb, 0x13, 0x92, 0x90, 0xf0, 0x90, 0x4e, 0xfa, 0x4f, 0x44, 0xef, 0xea, 0x52, - 0xd3, 0x73, 0x29, 0xca, 0x05, 0x7d, 0x82, 0xe3, 0x82, 0xdf, 0x1d, 0xb3, 0x41, 0xee, 0x4f, 0x0d, - 0xe1, 0x37, 0xbf, 0x54, 0xa0, 0x6a, 0xbb, 0x14, 0x3d, 0x13, 0xbb, 0x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x57, 0xa7, 0x66, 0x1f, 0x9e, 0xce, 0x75, - 0x30, 0x9d, 0xeb, 0xe0, 0xfb, 0x5c, 0x07, 0x6f, 0x17, 0xba, 0x32, 0x5d, 0xe8, 0xca, 0xd7, 0x85, - 0xae, 0x3c, 0xef, 0xfe, 0xb5, 0xf3, 0xaf, 0xe4, 0x2b, 0x2d, 0x3f, 0x0f, 0xfc, 0x20, 0xbc, 0x2a, - 0x7f, 0xa7, 0xef, 0xfd, 0x08, 0x00, 0x00, 0xff, 0xff, 0x97, 0xc5, 0xe2, 0xb4, 0x3d, 0x06, 0x00, - 0x00, + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0x3f, 0x6f, 0xd3, 0x4e, + 0x18, 0xc7, 0x7d, 0x4d, 0x7e, 0xf9, 0x95, 0x2b, 0xf4, 0x8f, 0x69, 0x83, 0xa9, 0x84, 0x1d, 0x59, + 0x0c, 0x11, 0x12, 0x0e, 0x2d, 0x4c, 0xdd, 0x70, 0x11, 0x52, 0xd5, 0x0e, 0x95, 0x85, 0x18, 0x58, + 0xa2, 0xb3, 0x7d, 0x38, 0x56, 0xe3, 0xbb, 0xc8, 0x77, 0xa9, 0xc8, 0x0b, 0x40, 0x42, 0xaa, 0x90, + 0x40, 0x62, 0x60, 0xec, 0xc2, 0xc2, 0x8b, 0x60, 0xee, 0x18, 0x31, 0x31, 0x05, 0x94, 0xbc, 0x83, + 0xbc, 0x02, 0xe4, 0xbb, 0xb3, 0x03, 0x2e, 0x10, 0x95, 0x01, 0xc4, 0x94, 0xdc, 0x3d, 0xcf, 0xf3, + 0xbd, 0xcf, 0xf3, 0xf8, 0x6b, 0x1f, 0xbc, 0x19, 0x50, 0x96, 0x50, 0xd6, 0x3a, 0xc6, 0x8c, 0xc7, + 0x24, 0x6a, 0x1d, 0x6f, 0xf9, 0x98, 0xa3, 0xad, 0x7c, 0xed, 0x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xad, 0x8b, 0x49, 0xc4, 0x3b, 0xe2, 0xa8, 0x8a, 0xa7, 0x56, + 0x7a, 0x00, 0x6b, 0x28, 0x11, 0x08, 0x73, 0xdf, 0xf1, 0x3b, 0x99, 0x81, 0x2f, 0x64, 0x52, 0x25, + 0xbd, 0x53, 0x15, 0x34, 0xef, 0x16, 0x60, 0x5d, 0xd2, 0xc4, 0xc1, 0xbf, 0x62, 0x32, 0x3d, 0x82, + 0x2b, 0x39, 0x54, 0x4f, 0xb0, 0x33, 0xf5, 0xe9, 0x31, 0x7f, 0x06, 0x25, 0x5b, 0x74, 0x4d, 0xf5, + 0xba, 0xd7, 0xa5, 0x7c, 0x49, 0xc4, 0xf6, 0x96, 0xd5, 0x8e, 0x4c, 0x67, 0xb3, 0xa7, 0xe6, 0xee, + 0x9f, 0x8d, 0x4d, 0x30, 0x1c, 0x9b, 0xe0, 0xcb, 0xd8, 0x04, 0xaf, 0x26, 0xa6, 0x36, 0x9c, 0x98, + 0xda, 0xa7, 0x89, 0xa9, 0x3d, 0xd9, 0xfa, 0xe5, 0xe4, 0x9f, 0xa9, 0x5b, 0x43, 0x5d, 0x57, 0xe2, + 0x41, 0xf8, 0x35, 0x71, 0x6f, 0xdc, 0xfd, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x98, 0xac, 0x59, 0xee, + 0xcd, 0x06, 0x00, 0x00, } func (m *BaseVestingAccount) Marshal() (dAtA []byte, err error) { @@ -449,6 +490,41 @@ func (m *DelayedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PermanentLockedVestingAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PermanentLockedVestingAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PermanentLockedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BaseVestingAccount != nil { + { + size, err := m.BaseVestingAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVesting(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Period) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -619,6 +695,19 @@ func (m *DelayedVestingAccount) Size() (n int) { return n } +func (m *PermanentLockedVestingAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BaseVestingAccount != nil { + l = m.BaseVestingAccount.Size() + n += 1 + l + sovVesting(uint64(l)) + } + return n +} + func (m *Period) Size() (n int) { if m == nil { return 0 @@ -1063,6 +1152,92 @@ func (m *DelayedVestingAccount) Unmarshal(dAtA []byte) error { } return nil } +func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PermanentLockedVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PermanentLockedVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseVestingAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVesting + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVesting + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BaseVestingAccount == nil { + m.BaseVestingAccount = &BaseVestingAccount{} + } + if err := m.BaseVestingAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVesting(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthVesting + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Period) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index e011bd6efbbf..b7c92c14a671 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -570,3 +570,68 @@ func (dva DelayedVestingAccount) String() string { out, _ := dva.MarshalYAML() return out.(string) } + +//----------------------------------------------------------------------------- +// Permanent Locked Vesting Account + +var _ vestexported.VestingAccount = (*PermanentLockedVestingAccount)(nil) +var _ authtypes.GenesisAccount = (*PermanentLockedVestingAccount)(nil) + +// NewPermanentLockedVestingAccountRaw creates a new PermanentLockedVestingAccount object from BaseVestingAccount +func NewPermanentLockedVestingAccountRaw(bva *BaseVestingAccount) *PermanentLockedVestingAccount { + bva.EndTime = -1 + + return &PermanentLockedVestingAccount{ + BaseVestingAccount: bva, + } +} + +// NewPermanentLockedVestingAccount returns a PermanentLockedVestingAccount +func NewPermanentLockedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins) *PermanentLockedVestingAccount { + baseVestingAcc := &BaseVestingAccount{ + BaseAccount: baseAcc, + OriginalVesting: originalVesting, + EndTime: -1, + } + + return &PermanentLockedVestingAccount{baseVestingAcc} +} + +// GetVestedCoins returns the total amount of vested coins for a permanent locked vesting +// account. All coins are only vested once the schedule has elapsed. +func (plva PermanentLockedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins { + return nil +} + +// GetVestingCoins returns the total number of vesting coins for a permanent locked +// vesting account. +func (plva PermanentLockedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins { + return plva.OriginalVesting +} + +// LockedCoins returns the set of coins that are not spendable (i.e. locked). +func (plva PermanentLockedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { + return plva.BaseVestingAccount.LockedCoinsFromVesting(plva.GetVestingCoins(blockTime)) +} + +// TrackDelegation tracks a desired delegation amount by setting the appropriate +// values for the amount of delegated vesting, delegated free, and reducing the +// overall amount of base coins. +func (plva *PermanentLockedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) { + plva.BaseVestingAccount.TrackDelegation(balance, plva.GetVestingCoins(blockTime), amount) +} + +// GetStartTime returns zero since a permanent locked vesting account has no start time. +func (plva PermanentLockedVestingAccount) GetStartTime() int64 { + return 0 +} + +// Validate checks for errors on the account fields +func (plva PermanentLockedVestingAccount) Validate() error { + return plva.BaseVestingAccount.Validate() +} + +func (plva PermanentLockedVestingAccount) String() string { + out, _ := plva.MarshalYAML() + return out.(string) +} From 148f6c29338c5a29be69518ee1c0b736989009ca Mon Sep 17 00:00:00 2001 From: Cory Levinson Date: Fri, 5 Feb 2021 18:22:12 -0800 Subject: [PATCH 02/14] remove sdk.Msg support for PermanentLockedVestingAccount --- docs/core/proto-docs.md | 48 +- proto/cosmos/vesting/v1beta1/tx.proto | 22 +- proto/cosmos/vesting/v1beta1/vesting.proto | 21 +- x/auth/vesting/msg_server.go | 8 +- x/auth/vesting/types/msgs.go | 12 +- x/auth/vesting/types/tx.pb.go | 573 ++++++++++++++++++--- x/auth/vesting/types/vesting.pb.go | 408 +++++++-------- x/auth/vesting/types/vesting_account.go | 1 + 8 files changed, 765 insertions(+), 328 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 8d0463abd765..e25915713bee 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -491,11 +491,11 @@ - [Query](#cosmos.upgrade.v1beta1.Query) - [cosmos/vesting/v1beta1/tx.proto](#cosmos/vesting/v1beta1/tx.proto) + - [MsgCreatePermanentLockedAccount](#cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount) + - [MsgCreatePermanentLockedAccountResponse](#cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse) - [MsgCreateVestingAccount](#cosmos.vesting.v1beta1.MsgCreateVestingAccount) - [MsgCreateVestingAccountResponse](#cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse) - - [VestingAccountType](#cosmos.vesting.v1beta1.VestingAccountType) - - [Msg](#cosmos.vesting.v1beta1.Msg) - [cosmos/vesting/v1beta1/vesting.proto](#cosmos/vesting/v1beta1/vesting.proto) @@ -7165,6 +7165,35 @@ Query defines the gRPC upgrade querier service. + + +### MsgCreatePermanentLockedAccount +MsgCreatePermanentLockedAccount defines a message that creates a permanent locked +account. The original coin balance of this account can be used for voting and delegation, but can +never be traded or sent to another account. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_address` | [string](#string) | | | +| `to_address` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### MsgCreatePermanentLockedAccountResponse +MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + + + + + + ### MsgCreateVestingAccount @@ -7178,7 +7207,7 @@ account. | `to_address` | [string](#string) | | | | `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | | `end_time` | [int64](#int64) | | | -| `vesting_account_type` | [VestingAccountType](#cosmos.vesting.v1beta1.VestingAccountType) | | | +| `delayed` | [bool](#bool) | | | @@ -7196,19 +7225,6 @@ MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response ty - - - -### VestingAccountType - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| DELAYED_VESTING_ACCOUNT_TYPE | 0 | | -| CONTINUOUS_VESTING_ACCOUNT_TYPE | 1 | | -| PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE | 2 | | - - diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 4f32c342731e..926c4ee310c4 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -24,16 +24,24 @@ message MsgCreateVestingAccount { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; int64 end_time = 4 [(gogoproto.moretags) = "yaml:\"end_time\""]; - - VestingAccountType vesting_account_type = 5 [(gogoproto.moretags) = "yaml:\"vesting_account_type\""]; + bool delayed = 5; } -enum VestingAccountType { - DELAYED_VESTING_ACCOUNT_TYPE = 0; - CONTINUOUS_VESTING_ACCOUNT_TYPE = 1; - PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE = 2; -} // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. message MsgCreateVestingAccountResponse {} +// MsgCreatePermanentLockedAccount defines a message that creates a permanent locked +// account. The original coin balance of this account can be used for voting and delegation, but can +// never be traded or sent to another account. +message MsgCreatePermanentLockedAccount { + option (gogoproto.equal) = true; + + string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; + string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. +message MsgCreatePermanentLockedAccountResponse {} \ No newline at end of file diff --git a/proto/cosmos/vesting/v1beta1/vesting.proto b/proto/cosmos/vesting/v1beta1/vesting.proto index 3cd601b8880c..7aba74be4513 100644 --- a/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/proto/cosmos/vesting/v1beta1/vesting.proto @@ -52,16 +52,6 @@ message DelayedVestingAccount { BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } -// PermanentLockedVestingAccount implements the VestingAccount interface. It does -// not ever release coins, locking them indefinitely. Coins in this account can -// still be used for delegating and for governance votes even while locked. -message PermanentLockedVestingAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; -} - // Period defines a length of time and amount of coins that will vest. message Period { option (gogoproto.goproto_stringer) = false; @@ -81,3 +71,14 @@ message PeriodicVestingAccount { int64 start_time = 2 [(gogoproto.moretags) = "yaml:\"start_time\""]; repeated Period vesting_periods = 3 [(gogoproto.moretags) = "yaml:\"vesting_periods\"", (gogoproto.nullable) = false]; } + +// PermanentLockedVestingAccount implements the VestingAccount interface. It does +// not ever release coins, locking them indefinitely. Coins in this account can +// still be used for delegating and for governance votes even while locked. +message PermanentLockedVestingAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; +} + diff --git a/x/auth/vesting/msg_server.go b/x/auth/vesting/msg_server.go index 0173e5df5232..dadd65dbcf1c 100644 --- a/x/auth/vesting/msg_server.go +++ b/x/auth/vesting/msg_server.go @@ -62,14 +62,10 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre var acc authtypes.AccountI - if msg.VestingAccountType == types.MsgCreateVestingAccount_CONTINUOUS_VESTING_ACCOUNT { - acc = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) - } else if msg.VestingAccountType == types.MsgCreateVestingAccount_DELAYED_VESTING_ACCOUNT { + if msg.Delayed { acc = types.NewDelayedVestingAccountRaw(baseVestingAccount) - } else if msg.VestingAccountType == types.MsgCreateVestingAccount_PERMANENT_LOCKED_VESTING_ACCOUNT { - acc = types.NewPermanentLockedVestingAccountRaw(baseVestingAccount) } else { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid account type; expected valid VestingAccountType, got: %v", msg.VestingAccountType) + acc = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) } ak.SetAccount(ctx, acc) diff --git a/x/auth/vesting/types/msgs.go b/x/auth/vesting/types/msgs.go index b26249cee038..3308e0304881 100644 --- a/x/auth/vesting/types/msgs.go +++ b/x/auth/vesting/types/msgs.go @@ -12,13 +12,13 @@ var _ sdk.Msg = &MsgCreateVestingAccount{} // NewMsgCreateVestingAccount returns a reference to a new MsgCreateVestingAccount. //nolint:interfacer -func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, vestingAccountType VestingAccountType) *MsgCreateVestingAccount { +func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, delayed bool) *MsgCreateVestingAccount { return &MsgCreateVestingAccount{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - Amount: amount, - EndTime: endTime, - VestingAccountType: vestingAccountType, + FromAddress: fromAddr.String(), + ToAddress: toAddr.String(), + Amount: amount, + EndTime: endTime, + Delayed: delayed, } } diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go index 34d118f10c91..509225c03396 100644 --- a/x/auth/vesting/types/tx.pb.go +++ b/x/auth/vesting/types/tx.pb.go @@ -30,42 +30,14 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type VestingAccountType int32 - -const ( - VestingAccountType_DELAYED_VESTING_ACCOUNT_TYPE VestingAccountType = 0 - VestingAccountType_CONTINUOUS_VESTING_ACCOUNT_TYPE VestingAccountType = 1 - VestingAccountType_PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE VestingAccountType = 2 -) - -var VestingAccountType_name = map[int32]string{ - 0: "DELAYED_VESTING_ACCOUNT_TYPE", - 1: "CONTINUOUS_VESTING_ACCOUNT_TYPE", - 2: "PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE", -} - -var VestingAccountType_value = map[string]int32{ - "DELAYED_VESTING_ACCOUNT_TYPE": 0, - "CONTINUOUS_VESTING_ACCOUNT_TYPE": 1, - "PERMANENT_LOCKED_VESTING_ACCOUNT_TYPE": 2, -} - -func (x VestingAccountType) String() string { - return proto.EnumName(VestingAccountType_name, int32(x)) -} - -func (VestingAccountType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{0} -} - // MsgCreateVestingAccount defines a message that enables creating a vesting // account. type MsgCreateVestingAccount struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` - EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty" yaml:"end_time"` - VestingAccountType VestingAccountType `protobuf:"varint,5,opt,name=vesting_account_type,json=vestingAccountType,proto3,enum=cosmos.vesting.v1beta1.VestingAccountType" json:"vesting_account_type,omitempty" yaml:"vesting_account_type"` + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty" yaml:"end_time"` + Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` } func (m *MsgCreateVestingAccount) Reset() { *m = MsgCreateVestingAccount{} } @@ -129,11 +101,11 @@ func (m *MsgCreateVestingAccount) GetEndTime() int64 { return 0 } -func (m *MsgCreateVestingAccount) GetVestingAccountType() VestingAccountType { +func (m *MsgCreateVestingAccount) GetDelayed() bool { if m != nil { - return m.VestingAccountType + return m.Delayed } - return VestingAccountType_DELAYED_VESTING_ACCOUNT_TYPE + return false } // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. @@ -173,49 +145,147 @@ func (m *MsgCreateVestingAccountResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateVestingAccountResponse proto.InternalMessageInfo +// MsgCreatePermanentLockedAccount defines a message that creates a permanent locked +// account. The original coin balance of this account can be used for voting and delegation, but can +// never be traded or sent to another account. +type MsgCreatePermanentLockedAccount struct { + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *MsgCreatePermanentLockedAccount) Reset() { *m = MsgCreatePermanentLockedAccount{} } +func (m *MsgCreatePermanentLockedAccount) String() string { return proto.CompactTextString(m) } +func (*MsgCreatePermanentLockedAccount) ProtoMessage() {} +func (*MsgCreatePermanentLockedAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{2} +} +func (m *MsgCreatePermanentLockedAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreatePermanentLockedAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreatePermanentLockedAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreatePermanentLockedAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreatePermanentLockedAccount.Merge(m, src) +} +func (m *MsgCreatePermanentLockedAccount) XXX_Size() int { + return m.Size() +} +func (m *MsgCreatePermanentLockedAccount) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreatePermanentLockedAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreatePermanentLockedAccount proto.InternalMessageInfo + +func (m *MsgCreatePermanentLockedAccount) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgCreatePermanentLockedAccount) GetToAddress() string { + if m != nil { + return m.ToAddress + } + return "" +} + +func (m *MsgCreatePermanentLockedAccount) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. +type MsgCreatePermanentLockedAccountResponse struct { +} + +func (m *MsgCreatePermanentLockedAccountResponse) Reset() { + *m = MsgCreatePermanentLockedAccountResponse{} +} +func (m *MsgCreatePermanentLockedAccountResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreatePermanentLockedAccountResponse) ProtoMessage() {} +func (*MsgCreatePermanentLockedAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{3} +} +func (m *MsgCreatePermanentLockedAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreatePermanentLockedAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreatePermanentLockedAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.Merge(m, src) +} +func (m *MsgCreatePermanentLockedAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreatePermanentLockedAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreatePermanentLockedAccountResponse proto.InternalMessageInfo + func init() { - proto.RegisterEnum("cosmos.vesting.v1beta1.VestingAccountType", VestingAccountType_name, VestingAccountType_value) proto.RegisterType((*MsgCreateVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccount") proto.RegisterType((*MsgCreateVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") + proto.RegisterType((*MsgCreatePermanentLockedAccount)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount") + proto.RegisterType((*MsgCreatePermanentLockedAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse") } func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } var fileDescriptor_5338ca97811f9792 = []byte{ - // 521 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x18, 0xcd, 0x35, 0xa5, 0xd0, 0x2b, 0xe2, 0xc7, 0x35, 0xd0, 0x10, 0x90, 0x2f, 0x18, 0x21, 0x85, - 0x4a, 0xd8, 0x24, 0x20, 0x21, 0x65, 0x4b, 0x5c, 0x0b, 0x55, 0x6d, 0x9c, 0xca, 0x75, 0x2a, 0x95, - 0xc5, 0x72, 0xec, 0xc3, 0xb5, 0xc0, 0xbe, 0x28, 0x77, 0x89, 0x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d0, 0x13, 0xf8, 0xf8, 0x40, 0x37, 0x5b, 0x0d, 0x43, 0x37, - 0x2c, 0x7b, 0xbf, 0xad, 0xed, 0x2d, 0xd3, 0x5b, 0xa9, 0x7d, 0x02, 0x30, 0xdf, 0x62, 0x3e, 0xfa, - 0x00, 0x60, 0x61, 0xe1, 0x60, 0xa9, 0xcb, 0x32, 0x5b, 0x62, 0xb1, 0xf4, 0xf2, 0x92, 0x84, 0x59, - 0x26, 0xcd, 0xbd, 0xb3, 0xb1, 0x04, 0xce, 0xc7, 0x12, 0xf8, 0x39, 0x96, 0xc0, 0xe7, 0x89, 0x94, - 0x3b, 0x9f, 0x48, 0xb9, 0xef, 0x13, 0x29, 0xf7, 0xba, 0xfa, 0xdf, 0xb9, 0x39, 0x55, 0x9d, 0x01, - 0x3f, 0x99, 0x2f, 0x61, 0x3a, 0x46, 0xdd, 0xb5, 0x74, 0x65, 0x9e, 0xff, 0x0e, 0x00, 0x00, 0xff, - 0xff, 0x39, 0x69, 0x73, 0x02, 0xa3, 0x03, 0x00, 0x00, + // 447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x53, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0x35, 0xa5, 0x3f, 0xae, 0x48, 0x08, 0xb7, 0x50, 0x93, 0xc1, 0x17, 0xbc, 0x60, 0x06, + 0xee, 0x48, 0x41, 0x42, 0xca, 0xd6, 0x74, 0x84, 0x4a, 0xc8, 0x42, 0x0c, 0x2c, 0xd5, 0xc5, 0xf7, + 0x70, 0xad, 0xf6, 0xee, 0x22, 0xdf, 0xa5, 0x6a, 0x36, 0x46, 0x46, 0xfe, 0x04, 0x66, 0xfe, 0x0a, + 0xc6, 0x8e, 0x1d, 0x99, 0x0c, 0x4a, 0x16, 0xe6, 0xfc, 0x01, 0x08, 0xd9, 0x67, 0x87, 0x0e, 0x0d, + 0x88, 0xb5, 0x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13, 0x23, 0x4e, 0x98, 0x9d, 0x8c, 0xc0, 0x54, + 0x04, 0x13, 0xd7, 0xd2, 0x1e, 0xc5, 0x1b, 0xa0, 0xc4, 0x91, 0xcd, 0x24, 0xf8, 0xab, 0x5d, 0x14, + 0xb5, 0x07, 0xdb, 0xf3, 0x82, 0xdc, 0x71, 0x83, 0x35, 0x9d, 0x30, 0x5e, 0x07, 0x25, 0xde, 0x64, + 0x12, 0x3c, 0x1f, 0xaf, 0x0b, 0x38, 0xe5, 0x13, 0x10, 0xfe, 0xad, 0x2e, 0x8a, 0x36, 0xe2, 0xa6, + 0xec, 0xaf, 0xfe, 0xfc, 0x4c, 0x50, 0xf8, 0x10, 0x93, 0x25, 0x09, 0xc6, 0x60, 0x46, 0x5a, 0x19, + 0x08, 0x7f, 0xa1, 0x2b, 0x98, 0xd7, 0x90, 0x4b, 0xae, 0x40, 0xd9, 0x57, 0x3a, 0x39, 0x01, 0x71, + 0xb3, 0xd3, 0xae, 0x33, 0x7a, 0x8c, 0x1f, 0xfd, 0xc3, 0x7f, 0x93, 0xd5, 0xde, 0x47, 0x84, 0xdb, + 0x87, 0x26, 0xf5, 0x3e, 0x20, 0xbc, 0x73, 0xed, 0xb3, 0x64, 0xf4, 0xfa, 0x0d, 0xa0, 0x4b, 0x6e, + 0xa1, 0xf3, 0xe2, 0x3f, 0x09, 0xcd, 0x28, 0x83, 0x97, 0x17, 0xd3, 0x00, 0x5d, 0x4e, 0x03, 0xf4, + 0x63, 0x1a, 0xa0, 0x4f, 0xb3, 0xa0, 0x75, 0x39, 0x0b, 0x5a, 0xdf, 0x66, 0x41, 0xeb, 0x5d, 0xef, + 0xaf, 0x39, 0x9c, 0x33, 0x3e, 0xb6, 0xc7, 0x8b, 0x15, 0xae, 0x62, 0x19, 0xae, 0x55, 0x0b, 0xf7, + 0xec, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x5d, 0xbe, 0x07, 0xe1, 0x03, 0x00, 0x00, } func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { @@ -254,11 +324,46 @@ func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { if this.EndTime != that1.EndTime { return false } - if this.VestingAccountType != that1.VestingAccountType { + if this.Delayed != that1.Delayed { return false } return true } +func (this *MsgCreatePermanentLockedAccount) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgCreatePermanentLockedAccount) + if !ok { + that2, ok := that.(MsgCreatePermanentLockedAccount) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.FromAddress != that1.FromAddress { + return false + } + if this.ToAddress != that1.ToAddress { + return false + } + if len(this.Amount) != len(that1.Amount) { + return false + } + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + return true +} // Reference imports to suppress errors if they are not otherwise used. var _ context.Context @@ -364,8 +469,13 @@ func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if m.VestingAccountType != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.VestingAccountType)) + if m.Delayed { + i-- + if m.Delayed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } i-- dAtA[i] = 0x28 } @@ -428,6 +538,80 @@ func (m *MsgCreateVestingAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *MsgCreatePermanentLockedAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreatePermanentLockedAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreatePermanentLockedAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ToAddress) > 0 { + i -= len(m.ToAddress) + copy(dAtA[i:], m.ToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreatePermanentLockedAccountResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreatePermanentLockedAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreatePermanentLockedAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -462,8 +646,8 @@ func (m *MsgCreateVestingAccount) Size() (n int) { if m.EndTime != 0 { n += 1 + sovTx(uint64(m.EndTime)) } - if m.VestingAccountType != 0 { - n += 1 + sovTx(uint64(m.VestingAccountType)) + if m.Delayed { + n += 2 } return n } @@ -477,6 +661,38 @@ func (m *MsgCreateVestingAccountResponse) Size() (n int) { return n } +func (m *MsgCreatePermanentLockedAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreatePermanentLockedAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -631,9 +847,9 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VestingAccountType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Delayed", wireType) } - m.VestingAccountType = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -643,11 +859,12 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VestingAccountType |= VestingAccountType(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.Delayed = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -719,6 +936,204 @@ func (m *MsgCreateVestingAccountResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreatePermanentLockedAccountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/auth/vesting/types/vesting.pb.go b/x/auth/vesting/types/vesting.pb.go index fc13dbb7af53..be7e728d4f00 100644 --- a/x/auth/vesting/types/vesting.pb.go +++ b/x/auth/vesting/types/vesting.pb.go @@ -146,45 +146,6 @@ func (m *DelayedVestingAccount) XXX_DiscardUnknown() { var xxx_messageInfo_DelayedVestingAccount proto.InternalMessageInfo -// PermanentLockedVestingAccount implements the VestingAccount interface. It does -// not ever release coins, locking them indefinitely. Coins in this account can -// still be used for delegating and for governance votes even while locked. -type PermanentLockedVestingAccount struct { - *BaseVestingAccount `protobuf:"bytes,1,opt,name=base_vesting_account,json=baseVestingAccount,proto3,embedded=base_vesting_account" json:"base_vesting_account,omitempty"` -} - -func (m *PermanentLockedVestingAccount) Reset() { *m = PermanentLockedVestingAccount{} } -func (*PermanentLockedVestingAccount) ProtoMessage() {} -func (*PermanentLockedVestingAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_89e80273ca606d6e, []int{3} -} -func (m *PermanentLockedVestingAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PermanentLockedVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PermanentLockedVestingAccount.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PermanentLockedVestingAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_PermanentLockedVestingAccount.Merge(m, src) -} -func (m *PermanentLockedVestingAccount) XXX_Size() int { - return m.Size() -} -func (m *PermanentLockedVestingAccount) XXX_DiscardUnknown() { - xxx_messageInfo_PermanentLockedVestingAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_PermanentLockedVestingAccount proto.InternalMessageInfo - // Period defines a length of time and amount of coins that will vest. type Period struct { Length int64 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"` @@ -194,7 +155,7 @@ type Period struct { func (m *Period) Reset() { *m = Period{} } func (*Period) ProtoMessage() {} func (*Period) Descriptor() ([]byte, []int) { - return fileDescriptor_89e80273ca606d6e, []int{4} + return fileDescriptor_89e80273ca606d6e, []int{3} } func (m *Period) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,7 +209,7 @@ type PeriodicVestingAccount struct { func (m *PeriodicVestingAccount) Reset() { *m = PeriodicVestingAccount{} } func (*PeriodicVestingAccount) ProtoMessage() {} func (*PeriodicVestingAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_89e80273ca606d6e, []int{5} + return fileDescriptor_89e80273ca606d6e, []int{4} } func (m *PeriodicVestingAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -277,13 +238,52 @@ func (m *PeriodicVestingAccount) XXX_DiscardUnknown() { var xxx_messageInfo_PeriodicVestingAccount proto.InternalMessageInfo +// PermanentLockedVestingAccount implements the VestingAccount interface. It does +// not ever release coins, locking them indefinitely. Coins in this account can +// still be used for delegating and for governance votes even while locked. +type PermanentLockedVestingAccount struct { + *BaseVestingAccount `protobuf:"bytes,1,opt,name=base_vesting_account,json=baseVestingAccount,proto3,embedded=base_vesting_account" json:"base_vesting_account,omitempty"` +} + +func (m *PermanentLockedVestingAccount) Reset() { *m = PermanentLockedVestingAccount{} } +func (*PermanentLockedVestingAccount) ProtoMessage() {} +func (*PermanentLockedVestingAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_89e80273ca606d6e, []int{5} +} +func (m *PermanentLockedVestingAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PermanentLockedVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PermanentLockedVestingAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PermanentLockedVestingAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_PermanentLockedVestingAccount.Merge(m, src) +} +func (m *PermanentLockedVestingAccount) XXX_Size() int { + return m.Size() +} +func (m *PermanentLockedVestingAccount) XXX_DiscardUnknown() { + xxx_messageInfo_PermanentLockedVestingAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_PermanentLockedVestingAccount proto.InternalMessageInfo + func init() { proto.RegisterType((*BaseVestingAccount)(nil), "cosmos.vesting.v1beta1.BaseVestingAccount") proto.RegisterType((*ContinuousVestingAccount)(nil), "cosmos.vesting.v1beta1.ContinuousVestingAccount") proto.RegisterType((*DelayedVestingAccount)(nil), "cosmos.vesting.v1beta1.DelayedVestingAccount") - proto.RegisterType((*PermanentLockedVestingAccount)(nil), "cosmos.vesting.v1beta1.PermanentLockedVestingAccount") proto.RegisterType((*Period)(nil), "cosmos.vesting.v1beta1.Period") proto.RegisterType((*PeriodicVestingAccount)(nil), "cosmos.vesting.v1beta1.PeriodicVestingAccount") + proto.RegisterType((*PermanentLockedVestingAccount)(nil), "cosmos.vesting.v1beta1.PermanentLockedVestingAccount") } func init() { @@ -291,46 +291,46 @@ func init() { } var fileDescriptor_89e80273ca606d6e = []byte{ - // 612 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0x3f, 0x6f, 0xd3, 0x4e, - 0x18, 0xc7, 0x7d, 0x4d, 0x7e, 0xf9, 0x95, 0x2b, 0xf4, 0x8f, 0x69, 0x83, 0xa9, 0x84, 0x1d, 0x59, - 0x0c, 0x11, 0x12, 0x0e, 0x2d, 0x4c, 0xdd, 0x70, 0x11, 0x52, 0xd5, 0x0e, 0x95, 0x85, 0x18, 0x58, - 0xa2, 0xb3, 0x7d, 0x38, 0x56, 0xe3, 0xbb, 0xc8, 0x77, 0xa9, 0xc8, 0x0b, 0x40, 0x42, 0xaa, 0x90, - 0x40, 0x62, 0x60, 0xec, 0xc2, 0xc2, 0x8b, 0x60, 0xee, 0x18, 0x31, 0x31, 0x05, 0x94, 0xbc, 0x83, - 0xbc, 0x02, 0xe4, 0xbb, 0xb3, 0x03, 0x2e, 0x10, 0x95, 0x01, 0xc4, 0x94, 0xdc, 0x3d, 0xcf, 0xf3, - 0xbd, 0xcf, 0xf3, 0xf8, 0x6b, 0x1f, 0xbc, 0x19, 0x50, 0x96, 0x50, 0xd6, 0x3a, 0xc6, 0x8c, 0xc7, - 0x24, 0x6a, 0x1d, 0x6f, 0x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x38, 0x8d, 0x69, 0xa8, 0xd7, 0x61, 0xad, 0x8b, 0x49, 0xc4, 0x3b, 0xe2, 0xa8, 0x8a, 0xa7, 0x56, - 0x7a, 0x00, 0x6b, 0x28, 0x11, 0x08, 0x73, 0xdf, 0xf1, 0x3b, 0x99, 0x81, 0x2f, 0x64, 0x52, 0x25, - 0xbd, 0x53, 0x15, 0x34, 0xef, 0x16, 0x60, 0x5d, 0xd2, 0xc4, 0xc1, 0xbf, 0x62, 0x32, 0x3d, 0x82, - 0x2b, 0x39, 0x54, 0x4f, 0xb0, 0x33, 0xf5, 0xe9, 0x31, 0x7f, 0x06, 0x25, 0x5b, 0x74, 0x4d, 0xf5, - 0xba, 0xd7, 0xa5, 0x7c, 0x49, 0xc4, 0xf6, 0x96, 0xd5, 0x8e, 0x4c, 0x67, 0xb3, 0xa7, 0xe6, 0xee, - 0x9f, 0x8d, 0x4d, 0x30, 0x1c, 0x9b, 0xe0, 0xcb, 0xd8, 0x04, 0xaf, 0x26, 0xa6, 0x36, 0x9c, 0x98, - 0xda, 0xa7, 0x89, 0xa9, 0x3d, 0xd9, 0xfa, 0xe5, 0xe4, 0x9f, 0xa9, 0x5b, 0x43, 0x5d, 0x57, 0xe2, - 0x41, 0xf8, 0x35, 0x71, 0x6f, 0xdc, 0xfd, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x98, 0xac, 0x59, 0xee, - 0xcd, 0x06, 0x00, 0x00, + // 611 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0xc6, 0x7d, 0x4d, 0x08, 0xe5, 0x0a, 0xfd, 0x63, 0xda, 0x60, 0x2a, 0x61, 0x47, 0x16, 0x43, + 0x84, 0x84, 0x43, 0x0b, 0x53, 0x37, 0x5c, 0x84, 0x54, 0xb5, 0x43, 0x65, 0x21, 0x06, 0x96, 0xe8, + 0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, 0xf7, 0xbf, 0x07, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x81, 0x11, 0xb8, 0xcd, + 0x06, 0x00, 0x00, } func (m *BaseVestingAccount) Marshal() (dAtA []byte, err error) { @@ -490,41 +490,6 @@ func (m *DelayedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PermanentLockedVestingAccount) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PermanentLockedVestingAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PermanentLockedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BaseVestingAccount != nil { - { - size, err := m.BaseVestingAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVesting(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Period) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -621,6 +586,41 @@ func (m *PeriodicVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *PermanentLockedVestingAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PermanentLockedVestingAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PermanentLockedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BaseVestingAccount != nil { + { + size, err := m.BaseVestingAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVesting(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintVesting(dAtA []byte, offset int, v uint64) int { offset -= sovVesting(v) base := offset @@ -695,19 +695,6 @@ func (m *DelayedVestingAccount) Size() (n int) { return n } -func (m *PermanentLockedVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BaseVestingAccount != nil { - l = m.BaseVestingAccount.Size() - n += 1 + l + sovVesting(uint64(l)) - } - return n -} - func (m *Period) Size() (n int) { if m == nil { return 0 @@ -748,6 +735,19 @@ func (m *PeriodicVestingAccount) Size() (n int) { return n } +func (m *PermanentLockedVestingAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BaseVestingAccount != nil { + l = m.BaseVestingAccount.Size() + n += 1 + l + sovVesting(uint64(l)) + } + return n +} + func sovVesting(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1152,7 +1152,7 @@ func (m *DelayedVestingAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { +func (m *Period) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1175,15 +1175,34 @@ func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PermanentLockedVestingAccount: wiretype end group for non-group") + return fmt.Errorf("proto: Period: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PermanentLockedVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Period: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + } + m.Length = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Length |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseVestingAccount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1210,10 +1229,8 @@ func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.BaseVestingAccount == nil { - m.BaseVestingAccount = &BaseVestingAccount{} - } - if err := m.BaseVestingAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Amount = append(m.Amount, types1.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1238,7 +1255,7 @@ func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *Period) Unmarshal(dAtA []byte) error { +func (m *PeriodicVestingAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1261,17 +1278,17 @@ func (m *Period) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Period: wiretype end group for non-group") + return fmt.Errorf("proto: PeriodicVestingAccount: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Period: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseVestingAccount", wireType) } - m.Length = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVesting @@ -1281,14 +1298,50 @@ func (m *Period) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Length |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthVesting + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVesting + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BaseVestingAccount == nil { + m.BaseVestingAccount = &BaseVestingAccount{} + } + if err := m.BaseVestingAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: + 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 ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1315,8 +1368,8 @@ func (m *Period) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.VestingPeriods = append(m.VestingPeriods, Period{}) + if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1341,7 +1394,7 @@ func (m *Period) Unmarshal(dAtA []byte) error { } return nil } -func (m *PeriodicVestingAccount) Unmarshal(dAtA []byte) error { +func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1364,10 +1417,10 @@ func (m *PeriodicVestingAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PeriodicVestingAccount: wiretype end group for non-group") + return fmt.Errorf("proto: PermanentLockedVestingAccount: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PermanentLockedVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1406,59 +1459,6 @@ func (m *PeriodicVestingAccount) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - 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 ErrIntOverflowVesting - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVesting - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthVesting - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthVesting - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VestingPeriods = append(m.VestingPeriods, Period{}) - if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVesting(dAtA[iNdEx:]) diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index b7c92c14a671..a7763b5627b9 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -579,6 +579,7 @@ var _ authtypes.GenesisAccount = (*PermanentLockedVestingAccount)(nil) // NewPermanentLockedVestingAccountRaw creates a new PermanentLockedVestingAccount object from BaseVestingAccount func NewPermanentLockedVestingAccountRaw(bva *BaseVestingAccount) *PermanentLockedVestingAccount { + // ensure EndTime is set to -1, as PermanentLockedVestingAccount's do not have an EndTime bva.EndTime = -1 return &PermanentLockedVestingAccount{ From 93d1ba916bc5401add47380aa814d6376cc2ca24 Mon Sep 17 00:00:00 2001 From: Cory Levinson Date: Fri, 5 Feb 2021 19:00:44 -0800 Subject: [PATCH 03/14] add tests for PermanentLockedVestingAccount --- x/auth/vesting/types/codec.go | 4 + x/auth/vesting/types/vesting_account_test.go | 171 +++++++++++++++++++ 2 files changed, 175 insertions(+) diff --git a/x/auth/vesting/types/codec.go b/x/auth/vesting/types/codec.go index eeaf80a95ad6..3dd30702392b 100644 --- a/x/auth/vesting/types/codec.go +++ b/x/auth/vesting/types/codec.go @@ -17,6 +17,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil) cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil) cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount", nil) + cdc.RegisterConcrete(&PermanentLockedVestingAccount{}, "cosmos-sdk/PermanentLockedVestingAccount", nil) } // RegisterInterface associates protoName with AccountI and VestingAccount @@ -28,6 +29,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &ContinuousVestingAccount{}, &DelayedVestingAccount{}, &PeriodicVestingAccount{}, + &PermanentLockedVestingAccount{}, ) registry.RegisterImplementations( @@ -36,6 +38,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &DelayedVestingAccount{}, &ContinuousVestingAccount{}, &PeriodicVestingAccount{}, + &PermanentLockedVestingAccount{}, ) registry.RegisterImplementations( @@ -44,6 +47,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &DelayedVestingAccount{}, &ContinuousVestingAccount{}, &PeriodicVestingAccount{}, + &PermanentLockedVestingAccount{}, ) registry.RegisterImplementations( diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 01a5e2ad9804..177537af18a8 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -578,6 +578,152 @@ func TestTrackUndelegationPeriodicVestingAcc(t *testing.T) { require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}, pva.DelegatedVesting) } +func TestGetVestedCoinsPermLockedVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(1000 * 24 * time.Hour) + + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + // require no coins are vested until schedule maturation + plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + vestedCoins := plva.GetVestedCoins(now) + require.Nil(t, vestedCoins) + + // require no coins be vested at end time + vestedCoins = plva.GetVestedCoins(endTime) + require.Nil(t, vestedCoins) +} + +func TestGetVestingCoinsPermLockedVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(1000 * 24 * time.Hour) + + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + // require all coins vesting at the beginning of the schedule + plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + vestingCoins := plva.GetVestingCoins(now) + require.Equal(t, origCoins, vestingCoins) + + // require all coins vesting at the end time + vestingCoins = plva.GetVestingCoins(endTime) + require.Equal(t, origCoins, vestingCoins) +} + +func TestSpendableCoinsPermLockedVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(1000 * 24 * time.Hour) + + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + // require that all coins are locked in the beginning of the vesting + // schedule + plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + lockedCoins := plva.LockedCoins(now) + require.True(t, lockedCoins.IsEqual(origCoins)) + + // require that all coins are still locked at end time + lockedCoins = plva.LockedCoins(endTime) + require.True(t, lockedCoins.IsEqual(origCoins)) + + // receive some coins + // require that only received coins are spendable since the original coins + // are all locked + lockedCoins = plva.LockedCoins(endTime) + require.True(t, lockedCoins.IsEqual(origCoins)) + + // delegate some locked coins + // require that locked is reduced + delegatedAmount := sdk.NewCoins(sdk.NewInt64Coin(stakeDenom, 50)) + plva.TrackDelegation(now.Add(12*time.Hour), origCoins, delegatedAmount) + lockedCoins = plva.LockedCoins(now.Add(12 * time.Hour)) + require.True(t, lockedCoins.IsEqual(origCoins.Sub(delegatedAmount))) +} + +func TestTrackDelegationPermLockedVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(1000 * 24 * time.Hour) + + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + // require the ability to delegate all vesting coins + plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva.TrackDelegation(now, origCoins, origCoins) + require.Equal(t, origCoins, plva.DelegatedVesting) + require.Nil(t, plva.DelegatedFree) + + // require the ability to delegate all vested coins at endTime + plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva.TrackDelegation(endTime, origCoins, origCoins) + require.Equal(t, origCoins, plva.DelegatedVesting) + require.Nil(t, plva.DelegatedFree) + + // require no modifications when delegation amount is zero or not enough funds + plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + + require.Panics(t, func() { + plva.TrackDelegation(endTime, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 1000000)}) + }) + require.Nil(t, plva.DelegatedVesting) + require.Nil(t, plva.DelegatedFree) +} + +func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(1000 * 24 * time.Hour) + + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + // require the ability to undelegate all vesting coins + plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva.TrackDelegation(now, origCoins, origCoins) + plva.TrackUndelegation(origCoins) + require.Nil(t, plva.DelegatedFree) + require.Nil(t, plva.DelegatedVesting) + + // require the ability to undelegate all vested coins at endTime + plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva.TrackDelegation(endTime, origCoins, origCoins) + plva.TrackUndelegation(origCoins) + require.Nil(t, plva.DelegatedFree) + require.Nil(t, plva.DelegatedVesting) + + // require no modifications when the undelegation amount is zero + plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + + require.Panics(t, func() { + plva.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 0)}) + }) + require.Nil(t, plva.DelegatedFree) + require.Nil(t, plva.DelegatedVesting) + + // vest 50% and delegate to two validators + plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva.TrackDelegation(now.Add(12*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + plva.TrackDelegation(now.Add(12*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + + // undelegate from one validator that got slashed 50% + plva.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}) + + require.Nil(t, plva.DelegatedFree) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 75)}, plva.DelegatedVesting) + + // undelegate from the other validator that did not get slashed + plva.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + require.Nil(t, plva.DelegatedFree) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}, plva.DelegatedVesting) +} + func TestGenesisAccountValidate(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.AccAddress(pubkey.Address()) @@ -633,6 +779,11 @@ func TestGenesisAccountValidate(t *testing.T) { 0, types.Periods{types.Period{Length: int64(100), Amount: sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 25)}}}), true, }, + { + "valid permanent locked vesting account", + types.NewPermanentLockedVestingAccount(baseAcc, initialVesting), + false, + }, } for _, tt := range tests { @@ -707,3 +858,23 @@ func TestDelayedVestingAccountMarshal(t *testing.T) { _, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2]) require.NotNil(t, err) } +func TestPermanentLockedVestingAccountMarshal(t *testing.T) { + pubkey := secp256k1.GenPrivKey().PubKey() + addr := sdk.AccAddress(pubkey.Address()) + coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) + + acc := types.NewPermanentLockedVestingAccount(baseAcc, coins) + + bz, err := app.AccountKeeper.MarshalAccount(acc) + require.Nil(t, err) + + acc2, err := app.AccountKeeper.UnmarshalAccount(bz) + require.Nil(t, err) + require.IsType(t, &types.PermanentLockedVestingAccount{}, acc2) + require.Equal(t, acc.String(), acc2.String()) + + // error on bad bytes + _, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2]) + require.NotNil(t, err) +} From 697ee2f322adfae82b7f58e9634a068699806db4 Mon Sep 17 00:00:00 2001 From: Cory Levinson Date: Tue, 2 Mar 2021 12:50:32 -0800 Subject: [PATCH 04/14] remove unecessary tests --- x/auth/vesting/types/vesting_account_test.go | 21 -------------------- 1 file changed, 21 deletions(-) diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 177537af18a8..c31550375b2a 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -89,10 +89,6 @@ func TestSpendableCoinsContVestingAcc(t *testing.T) { // require that all vested coins (50%) are spendable lockedCoins = cva.LockedCoins(now.Add(12 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) - - // require that all vested coins (50%) are spendable plus any received - lockedCoins = cva.LockedCoins(now.Add(12 * time.Hour)) - require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) } func TestTrackDelegationContVestingAcc(t *testing.T) { @@ -241,12 +237,6 @@ func TestSpendableCoinsDelVestingAcc(t *testing.T) { lockedCoins = dva.LockedCoins(now.Add(12 * time.Hour)) require.True(t, lockedCoins.IsEqual(origCoins)) - // receive some coins - // require that only received coins are spendable since the account is still - // vesting - lockedCoins = dva.LockedCoins(now.Add(12 * time.Hour)) - require.True(t, lockedCoins.IsEqual(origCoins)) - // delegate some locked coins // require that locked is reduced delegatedAmount := sdk.NewCoins(sdk.NewInt64Coin(stakeDenom, 50)) @@ -453,11 +443,6 @@ func TestSpendableCoinsPeriodicVestingAcc(t *testing.T) { // require that all still vesting coins (50%) are locked lockedCoins = pva.LockedCoins(now.Add(12 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) - - // receive some coins - // require that all still vesting coins (50% of original) are locked plus any received - lockedCoins = pva.LockedCoins(now.Add(12 * time.Hour)) - require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) } func TestTrackDelegationPeriodicVestingAcc(t *testing.T) { @@ -632,12 +617,6 @@ func TestSpendableCoinsPermLockedVestingAcc(t *testing.T) { lockedCoins = plva.LockedCoins(endTime) require.True(t, lockedCoins.IsEqual(origCoins)) - // receive some coins - // require that only received coins are spendable since the original coins - // are all locked - lockedCoins = plva.LockedCoins(endTime) - require.True(t, lockedCoins.IsEqual(origCoins)) - // delegate some locked coins // require that locked is reduced delegatedAmount := sdk.NewCoins(sdk.NewInt64Coin(stakeDenom, 50)) From 5f96bf0d5c82ceac48ce0d48c00ba9e057cff537 Mon Sep 17 00:00:00 2001 From: Cory Levinson Date: Tue, 2 Mar 2021 18:37:20 -0800 Subject: [PATCH 05/14] drop unecessary create vesting acct msgs --- docs/core/proto-docs.md | 31 -- proto/cosmos/vesting/v1beta1/tx.proto | 18 +- proto/cosmos/vesting/v1beta1/vesting.proto | 1 - x/auth/vesting/types/tx.pb.go | 499 ++------------------- 4 files changed, 28 insertions(+), 521 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index e25915713bee..45c015ceab5b 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -491,8 +491,6 @@ - [Query](#cosmos.upgrade.v1beta1.Query) - [cosmos/vesting/v1beta1/tx.proto](#cosmos/vesting/v1beta1/tx.proto) - - [MsgCreatePermanentLockedAccount](#cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount) - - [MsgCreatePermanentLockedAccountResponse](#cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse) - [MsgCreateVestingAccount](#cosmos.vesting.v1beta1.MsgCreateVestingAccount) - [MsgCreateVestingAccountResponse](#cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse) @@ -7165,35 +7163,6 @@ Query defines the gRPC upgrade querier service. - - -### MsgCreatePermanentLockedAccount -MsgCreatePermanentLockedAccount defines a message that creates a permanent locked -account. The original coin balance of this account can be used for voting and delegation, but can -never be traded or sent to another account. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | -| `to_address` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | - - - - - - - - -### MsgCreatePermanentLockedAccountResponse -MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. - - - - - - ### MsgCreateVestingAccount diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 926c4ee310c4..c49be802a76e 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -27,21 +27,5 @@ message MsgCreateVestingAccount { bool delayed = 5; } - // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. -message MsgCreateVestingAccountResponse {} - -// MsgCreatePermanentLockedAccount defines a message that creates a permanent locked -// account. The original coin balance of this account can be used for voting and delegation, but can -// never be traded or sent to another account. -message MsgCreatePermanentLockedAccount { - option (gogoproto.equal) = true; - - string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; - string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} - -// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. -message MsgCreatePermanentLockedAccountResponse {} \ No newline at end of file +message MsgCreateVestingAccountResponse {} \ No newline at end of file diff --git a/proto/cosmos/vesting/v1beta1/vesting.proto b/proto/cosmos/vesting/v1beta1/vesting.proto index 7aba74be4513..44e4044fc49c 100644 --- a/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/proto/cosmos/vesting/v1beta1/vesting.proto @@ -81,4 +81,3 @@ message PermanentLockedVestingAccount { BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } - diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go index 509225c03396..d07a154dd326 100644 --- a/x/auth/vesting/types/tx.pb.go +++ b/x/auth/vesting/types/tx.pb.go @@ -145,147 +145,41 @@ func (m *MsgCreateVestingAccountResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateVestingAccountResponse proto.InternalMessageInfo -// MsgCreatePermanentLockedAccount defines a message that creates a permanent locked -// account. The original coin balance of this account can be used for voting and delegation, but can -// never be traded or sent to another account. -type MsgCreatePermanentLockedAccount struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` -} - -func (m *MsgCreatePermanentLockedAccount) Reset() { *m = MsgCreatePermanentLockedAccount{} } -func (m *MsgCreatePermanentLockedAccount) String() string { return proto.CompactTextString(m) } -func (*MsgCreatePermanentLockedAccount) ProtoMessage() {} -func (*MsgCreatePermanentLockedAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{2} -} -func (m *MsgCreatePermanentLockedAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreatePermanentLockedAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreatePermanentLockedAccount.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCreatePermanentLockedAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreatePermanentLockedAccount.Merge(m, src) -} -func (m *MsgCreatePermanentLockedAccount) XXX_Size() int { - return m.Size() -} -func (m *MsgCreatePermanentLockedAccount) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreatePermanentLockedAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreatePermanentLockedAccount proto.InternalMessageInfo - -func (m *MsgCreatePermanentLockedAccount) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgCreatePermanentLockedAccount) GetToAddress() string { - if m != nil { - return m.ToAddress - } - return "" -} - -func (m *MsgCreatePermanentLockedAccount) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. -type MsgCreatePermanentLockedAccountResponse struct { -} - -func (m *MsgCreatePermanentLockedAccountResponse) Reset() { - *m = MsgCreatePermanentLockedAccountResponse{} -} -func (m *MsgCreatePermanentLockedAccountResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreatePermanentLockedAccountResponse) ProtoMessage() {} -func (*MsgCreatePermanentLockedAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{3} -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.Merge(m, src) -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreatePermanentLockedAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreatePermanentLockedAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreatePermanentLockedAccountResponse proto.InternalMessageInfo - func init() { proto.RegisterType((*MsgCreateVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccount") proto.RegisterType((*MsgCreateVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") - proto.RegisterType((*MsgCreatePermanentLockedAccount)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount") - proto.RegisterType((*MsgCreatePermanentLockedAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse") } func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } var fileDescriptor_5338ca97811f9792 = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xce, 0x35, 0xa5, 0x3f, 0xae, 0x48, 0x08, 0xb7, 0x50, 0x93, 0xc1, 0x17, 0xbc, 0x60, 0x06, - 0xee, 0x48, 0x41, 0x42, 0xca, 0xd6, 0x74, 0x84, 0x4a, 0xc8, 0x42, 0x0c, 0x2c, 0xd5, 0xc5, 0xf7, - 0x70, 0xad, 0xf6, 0xee, 0x22, 0xdf, 0xa5, 0x6a, 0x36, 0x46, 0x46, 0xfe, 0x04, 0x66, 0xfe, 0x0a, - 0xc6, 0x8e, 0x1d, 0x99, 0x0c, 0x4a, 0x16, 0xe6, 0xfc, 0x01, 0x08, 0xd9, 0x67, 0x87, 0x0e, 0x0d, - 0x88, 0xb5, 0x93, 0xfd, 0xf4, 0xbe, 0xef, 0xbb, 0xf7, 0x7d, 0x77, 0x0f, 0x93, 0x44, 0x1b, 0xa9, - 0x0d, 0x3b, 0x03, 0x63, 0x33, 0x95, 0xb2, 0xb3, 0xde, 0x10, 0x2c, 0xef, 0x31, 0x7b, 0x4e, 0x47, - 0xb9, 0xb6, 0xda, 0xbb, 0xef, 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0x5e, 0x07, 0x25, 0xde, 0x64, - 0x12, 0x3c, 0x1f, 0xaf, 0x0b, 0x38, 0xe5, 0x13, 0x10, 0xfe, 0xad, 0x2e, 0x8a, 0x36, 0xe2, 0xa6, - 0xec, 0xaf, 0xfe, 0xfc, 0x4c, 0x50, 0xf8, 0x10, 0x93, 0x25, 0x09, 0xc6, 0x60, 0x46, 0x5a, 0x19, - 0x08, 0x7f, 0xa1, 0x2b, 0x98, 0xd7, 0x90, 0x4b, 0xae, 0x40, 0xd9, 0x57, 0x3a, 0x39, 0x01, 0x71, - 0xb3, 0xd3, 0xae, 0x33, 0x7a, 0x8c, 0x1f, 0xfd, 0xc3, 0x7f, 0x93, 0xd5, 0xde, 0x47, 0x84, 0xdb, - 0x87, 0x26, 0xf5, 0x3e, 0x20, 0xbc, 0x73, 0xed, 0xb3, 0x64, 0xf4, 0xfa, 0x0d, 0xa0, 0x4b, 0x6e, - 0xa1, 0xf3, 0xe2, 0x3f, 0x09, 0xcd, 0x28, 0x83, 0x97, 0x17, 0xd3, 0x00, 0x5d, 0x4e, 0x03, 0xf4, - 0x63, 0x1a, 0xa0, 0x4f, 0xb3, 0xa0, 0x75, 0x39, 0x0b, 0x5a, 0xdf, 0x66, 0x41, 0xeb, 0x5d, 0xef, - 0xaf, 0x39, 0x9c, 0x33, 0x3e, 0xb6, 0xc7, 0x8b, 0x15, 0xae, 0x62, 0x19, 0xae, 0x55, 0x0b, 0xf7, - 0xec, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x5d, 0xbe, 0x07, 0xe1, 0x03, 0x00, 0x00, + // 410 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xbd, 0xae, 0xd3, 0x30, + 0x14, 0x8e, 0x6f, 0x2e, 0xf7, 0xc7, 0x17, 0x09, 0x91, 0x16, 0x1a, 0x3a, 0xc4, 0x21, 0x53, 0x16, + 0x6c, 0x5a, 0x90, 0x90, 0xba, 0x35, 0x1d, 0x51, 0x97, 0x08, 0x31, 0xb0, 0x54, 0x4e, 0x62, 0xd2, + 0x88, 0x26, 0xae, 0x62, 0xb7, 0x6a, 0x37, 0x46, 0x46, 0x1e, 0x81, 0x99, 0xa7, 0x60, 0xec, 0xd8, + 0x91, 0x29, 0xa0, 0x76, 0x61, 0xee, 0x13, 0xa0, 0xc4, 0x49, 0x61, 0x68, 0x91, 0x98, 0xec, 0xa3, + 0xef, 0xc7, 0xe7, 0x7c, 0x3e, 0x10, 0x85, 0x5c, 0xa4, 0x5c, 0x90, 0x25, 0x13, 0x32, 0xc9, 0x62, + 0xb2, 0xec, 0x05, 0x4c, 0xd2, 0x1e, 0x91, 0x2b, 0x3c, 0xcf, 0xb9, 0xe4, 0xc6, 0x63, 0x45, 0xc0, + 0x35, 0x01, 0xd7, 0x84, 0x6e, 0x3b, 0xe6, 0x31, 0xaf, 0x28, 0xa4, 0xbc, 0x29, 0x76, 0xd7, 0xaa, + 0xed, 0x02, 0x2a, 0xd8, 0xd1, 0x2b, 0xe4, 0x49, 0xa6, 0x70, 0xe7, 0xdb, 0x05, 0xec, 0x8c, 0x45, + 0x3c, 0xca, 0x19, 0x95, 0xec, 0xad, 0xb2, 0x1c, 0x86, 0x21, 0x5f, 0x64, 0xd2, 0x18, 0xc0, 0xfb, + 0xef, 0x73, 0x9e, 0x4e, 0x68, 0x14, 0xe5, 0x4c, 0x08, 0x13, 0xd8, 0xc0, 0xbd, 0xf5, 0x3a, 0x87, + 0x02, 0xb5, 0xd6, 0x34, 0x9d, 0x0d, 0x9c, 0xbf, 0x51, 0xc7, 0xbf, 0x2b, 0xcb, 0xa1, 0xaa, 0x8c, + 0x97, 0x10, 0x4a, 0x7e, 0x54, 0x5e, 0x54, 0xca, 0x47, 0x87, 0x02, 0x3d, 0x54, 0xca, 0x3f, 0x98, + 0xe3, 0xdf, 0x4a, 0xde, 0xa8, 0x42, 0x78, 0x45, 0xd3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+ 0xff, 0xff, 0xe7, 0x28, 0xaf, 0xe5, 0xb5, 0x02, 0x00, 0x00, } func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { @@ -329,41 +223,6 @@ func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { } return true } -func (this *MsgCreatePermanentLockedAccount) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgCreatePermanentLockedAccount) - if !ok { - that2, ok := that.(MsgCreatePermanentLockedAccount) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.FromAddress != that1.FromAddress { - return false - } - if this.ToAddress != that1.ToAddress { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - return true -} // Reference imports to suppress errors if they are not otherwise used. var _ context.Context @@ -538,80 +397,6 @@ func (m *MsgCreateVestingAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *MsgCreatePermanentLockedAccount) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreatePermanentLockedAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePermanentLockedAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ToAddress) > 0 { - i -= len(m.ToAddress) - copy(dAtA[i:], m.ToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreatePermanentLockedAccountResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgCreatePermanentLockedAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreatePermanentLockedAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -661,38 +446,6 @@ func (m *MsgCreateVestingAccountResponse) Size() (n int) { return n } -func (m *MsgCreatePermanentLockedAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgCreatePermanentLockedAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -936,204 +689,6 @@ func (m *MsgCreateVestingAccountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreatePermanentLockedAccountResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From c88a1da607fa09ff8120a60a06c8a9fff6e58c80 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 14:21:15 +0200 Subject: [PATCH 06/14] Update x/auth/vesting/types/vesting_account.go Co-authored-by: Aaron Craelius --- x/auth/vesting/types/vesting_account.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 6b518939e0bd..0a037739ab5e 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -584,7 +584,7 @@ func NewPermanentLockedVestingAccountRaw(bva *BaseVestingAccount) *PermanentLock } // NewPermanentLockedVestingAccount returns a PermanentLockedVestingAccount -func NewPermanentLockedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins) *PermanentLockedVestingAccount { +func NewPermanentLockedVestingAccount(baseAcc *authtypes.BaseAccount, coins sdk.Coins) *PermanentLockedVestingAccount { baseVestingAcc := &BaseVestingAccount{ BaseAccount: baseAcc, OriginalVesting: originalVesting, From 987ca0542de932c3414d7894009baa3b0c4826a8 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 14:22:01 +0200 Subject: [PATCH 07/14] Update x/auth/vesting/types/vesting_account.go Co-authored-by: Aaron Craelius --- x/auth/vesting/types/vesting_account.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 0a037739ab5e..56b834cbed22 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -608,7 +608,7 @@ func (plva PermanentLockedVestingAccount) GetVestingCoins(blockTime time.Time) s // LockedCoins returns the set of coins that are not spendable (i.e. locked). func (plva PermanentLockedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { - return plva.BaseVestingAccount.LockedCoinsFromVesting(plva.GetVestingCoins(blockTime)) + return nil } // TrackDelegation tracks a desired delegation amount by setting the appropriate From 162a1d65fed853b4caa1677e5ca0d697d3fef5ca Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 14:22:10 +0200 Subject: [PATCH 08/14] Update x/auth/vesting/types/vesting_account.go Co-authored-by: Aaron Craelius --- x/auth/vesting/types/vesting_account.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 56b834cbed22..9fa6e665c9d4 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -615,7 +615,7 @@ func (plva PermanentLockedVestingAccount) LockedCoins(blockTime time.Time) sdk.C // values for the amount of delegated vesting, delegated free, and reducing the // overall amount of base coins. func (plva *PermanentLockedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) { - plva.BaseVestingAccount.TrackDelegation(balance, plva.GetVestingCoins(blockTime), amount) + plva.BaseVestingAccount.TrackDelegation(balance, plva.OriginalVesting, amount) } // GetStartTime returns zero since a permanent locked vesting account has no start time. From 06216a3cd56aa55605fc7d17bece255a0d31b604 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 14:22:41 +0200 Subject: [PATCH 09/14] Update x/auth/vesting/types/vesting_account_test.go Co-authored-by: Aaron Craelius --- x/auth/vesting/types/vesting_account_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index c31550375b2a..43da76796c27 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -571,7 +571,7 @@ func TestGetVestedCoinsPermLockedVestingAcc(t *testing.T) { origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} bacc := authtypes.NewBaseAccountWithAddress(addr) - // require no coins are vested until schedule maturation + // require no coins are vested plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) vestedCoins := plva.GetVestedCoins(now) require.Nil(t, vestedCoins) From a2443f4fc858e51e835f880a4562d3f89fd4e6a7 Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 15:46:06 +0200 Subject: [PATCH 10/14] Review changes --- x/auth/vesting/types/common_test.go | 3 +- x/auth/vesting/types/vesting_account.go | 32 ++++++++++---------- x/auth/vesting/types/vesting_account_test.go | 14 ++++++--- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/x/auth/vesting/types/common_test.go b/x/auth/vesting/types/common_test.go index 8e57a28c0a62..289b2d427701 100644 --- a/x/auth/vesting/types/common_test.go +++ b/x/auth/vesting/types/common_test.go @@ -5,6 +5,5 @@ import ( ) var ( - app = simapp.Setup(false) - appCodec = simapp.MakeTestEncodingConfig().Marshaler + app = simapp.Setup(false) ) diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 36c6175022c5..3e3f3af96a65 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -529,22 +529,12 @@ func (dva DelayedVestingAccount) String() string { var _ vestexported.VestingAccount = (*PermanentLockedVestingAccount)(nil) var _ authtypes.GenesisAccount = (*PermanentLockedVestingAccount)(nil) -// NewPermanentLockedVestingAccountRaw creates a new PermanentLockedVestingAccount object from BaseVestingAccount -func NewPermanentLockedVestingAccountRaw(bva *BaseVestingAccount) *PermanentLockedVestingAccount { - // ensure EndTime is set to -1, as PermanentLockedVestingAccount's do not have an EndTime - bva.EndTime = -1 - - return &PermanentLockedVestingAccount{ - BaseVestingAccount: bva, - } -} - // NewPermanentLockedVestingAccount returns a PermanentLockedVestingAccount func NewPermanentLockedVestingAccount(baseAcc *authtypes.BaseAccount, coins sdk.Coins) *PermanentLockedVestingAccount { baseVestingAcc := &BaseVestingAccount{ BaseAccount: baseAcc, - OriginalVesting: originalVesting, - EndTime: -1, + OriginalVesting: coins, + EndTime: -1, // ensure EndTime is set to -1, as PermanentLockedVestingAccount's do not have an EndTime } return &PermanentLockedVestingAccount{baseVestingAcc} @@ -552,19 +542,19 @@ func NewPermanentLockedVestingAccount(baseAcc *authtypes.BaseAccount, coins sdk. // GetVestedCoins returns the total amount of vested coins for a permanent locked vesting // account. All coins are only vested once the schedule has elapsed. -func (plva PermanentLockedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins { +func (plva PermanentLockedVestingAccount) GetVestedCoins(_ time.Time) sdk.Coins { return nil } // GetVestingCoins returns the total number of vesting coins for a permanent locked // vesting account. -func (plva PermanentLockedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins { +func (plva PermanentLockedVestingAccount) GetVestingCoins(_ time.Time) sdk.Coins { return plva.OriginalVesting } // LockedCoins returns the set of coins that are not spendable (i.e. locked). -func (plva PermanentLockedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { - return nil +func (plva PermanentLockedVestingAccount) LockedCoins(_ time.Time) sdk.Coins { + return plva.BaseVestingAccount.LockedCoinsFromVesting(plva.OriginalVesting) } // TrackDelegation tracks a desired delegation amount by setting the appropriate @@ -579,8 +569,18 @@ func (plva PermanentLockedVestingAccount) GetStartTime() int64 { return 0 } +// GetEndTime returns a vesting account's end time, we return -1 to denote that +// a permanently locked vesting account has no end time. +func (plva PermanentLockedVestingAccount) GetEndTime() int64 { + return -1 +} + // Validate checks for errors on the account fields func (plva PermanentLockedVestingAccount) Validate() error { + if plva.EndTime > 0 { + return errors.New("permanently vested accounts cannot have an end-time") + } + return plva.BaseVestingAccount.Validate() } diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 43da76796c27..1551f304a581 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -670,7 +670,7 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { require.Nil(t, plva.DelegatedFree) require.Nil(t, plva.DelegatedVesting) - // require the ability to undelegate all vested coins at endTime + // require the ability to undelegate all vesting coins at endTime plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) plva.TrackDelegation(endTime, origCoins, origCoins) plva.TrackUndelegation(origCoins) @@ -679,17 +679,16 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { // require no modifications when the undelegation amount is zero plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) - require.Panics(t, func() { plva.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 0)}) }) require.Nil(t, plva.DelegatedFree) require.Nil(t, plva.DelegatedVesting) - // vest 50% and delegate to two validators + // delegate to two validators plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) - plva.TrackDelegation(now.Add(12*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) - plva.TrackDelegation(now.Add(12*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + plva.TrackDelegation(now, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + plva.TrackDelegation(now, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) // undelegate from one validator that got slashed 50% plva.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}) @@ -763,6 +762,11 @@ func TestGenesisAccountValidate(t *testing.T) { types.NewPermanentLockedVestingAccount(baseAcc, initialVesting), false, }, + { + "invalid positive end time for permanently locked vest account", + &types.PermanentLockedVestingAccount{BaseVestingAccount: baseVestingWithCoins}, + true, + }, } for _, tt := range tests { From d8f6930f2dadec56c649ce10880d3287cc178889 Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:00:14 +0200 Subject: [PATCH 11/14] Factorize init function --- x/auth/vesting/types/vesting_account_test.go | 91 ++++++-------------- 1 file changed, 28 insertions(+), 63 deletions(-) diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 1551f304a581..a4796f512b9b 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -23,9 +23,7 @@ func TestGetVestedCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) // require no coins vested in the very beginning of the vesting schedule @@ -49,9 +47,7 @@ func TestGetVestingCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) // require all coins vesting in the beginning of the vesting schedule @@ -71,10 +67,7 @@ func TestSpendableCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) - + bacc, origCoins := createAccount() cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) // require that all original coins are locked at the end of the vesting @@ -95,9 +88,7 @@ func TestTrackDelegationContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to delegate all vesting coins cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) @@ -134,9 +125,7 @@ func TestTrackUndelegationContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to undelegate all vesting coins cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) @@ -182,9 +171,7 @@ func TestGetVestedCoinsDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require no coins are vested until schedule maturation dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -200,9 +187,7 @@ func TestGetVestingCoinsDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require all coins vesting at the beginning of the schedule dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -218,9 +203,7 @@ func TestSpendableCoinsDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require that all coins are locked in the beginning of the vesting // schedule @@ -249,9 +232,7 @@ func TestTrackDelegationDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to delegate all vesting coins dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -286,9 +267,7 @@ func TestTrackUndelegationDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to undelegate all vesting coins dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -339,9 +318,7 @@ func TestGetVestedCoinsPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require no coins vested at the beginning of the vesting schedule @@ -384,10 +361,7 @@ func TestGetVestingCoinsPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{ - sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require all coins vesting at the beginning of the vesting schedule @@ -424,10 +398,7 @@ func TestSpendableCoinsPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{ - sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require that there exist no spendable coins at the beginning of the @@ -454,9 +425,7 @@ func TestTrackDelegationPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to delegate all vesting coins pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) @@ -512,9 +481,7 @@ func TestTrackUndelegationPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to undelegate all vesting coins at the beginning of vesting pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) @@ -567,9 +534,7 @@ func TestGetVestedCoinsPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require no coins are vested plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -585,9 +550,7 @@ func TestGetVestingCoinsPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require all coins vesting at the beginning of the schedule plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -603,9 +566,7 @@ func TestSpendableCoinsPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require that all coins are locked in the beginning of the vesting // schedule @@ -629,9 +590,7 @@ func TestTrackDelegationPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to delegate all vesting coins plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -659,9 +618,7 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - _, _, addr := testdata.KeyTestPubAddr() - origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} - bacc := authtypes.NewBaseAccountWithAddress(addr) + bacc, origCoins := createAccount() // require the ability to undelegate all vesting coins plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -861,3 +818,11 @@ func TestPermanentLockedVestingAccountMarshal(t *testing.T) { _, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2]) require.NotNil(t, err) } + +func createAccount() (*authtypes.BaseAccount, sdk.Coins) { + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + return bacc, origCoins +} From 072a6d0f827d8f37beca169495f0b2fa7dc9e7fc Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:03:29 +0200 Subject: [PATCH 12/14] Factorize more --- x/auth/vesting/types/vesting_account_test.go | 66 ++++++++------------ 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index a4796f512b9b..330e8be15be8 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -23,7 +23,7 @@ func TestGetVestedCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) // require no coins vested in the very beginning of the vesting schedule @@ -47,7 +47,7 @@ func TestGetVestingCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) // require all coins vesting in the beginning of the vesting schedule @@ -67,7 +67,7 @@ func TestSpendableCoinsContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) // require that all original coins are locked at the end of the vesting @@ -88,7 +88,7 @@ func TestTrackDelegationContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to delegate all vesting coins cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) @@ -125,7 +125,7 @@ func TestTrackUndelegationContVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to undelegate all vesting coins cva := types.NewContinuousVestingAccount(bacc, origCoins, now.Unix(), endTime.Unix()) @@ -171,7 +171,7 @@ func TestGetVestedCoinsDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require no coins are vested until schedule maturation dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -187,7 +187,7 @@ func TestGetVestingCoinsDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require all coins vesting at the beginning of the schedule dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -203,7 +203,7 @@ func TestSpendableCoinsDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require that all coins are locked in the beginning of the vesting // schedule @@ -232,7 +232,7 @@ func TestTrackDelegationDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to delegate all vesting coins dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -267,7 +267,7 @@ func TestTrackUndelegationDelVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to undelegate all vesting coins dva := types.NewDelayedVestingAccount(bacc, origCoins, endTime.Unix()) @@ -318,7 +318,7 @@ func TestGetVestedCoinsPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require no coins vested at the beginning of the vesting schedule @@ -361,7 +361,7 @@ func TestGetVestingCoinsPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require all coins vesting at the beginning of the vesting schedule @@ -398,7 +398,7 @@ func TestSpendableCoinsPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require that there exist no spendable coins at the beginning of the @@ -425,7 +425,7 @@ func TestTrackDelegationPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to delegate all vesting coins pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) @@ -481,7 +481,7 @@ func TestTrackUndelegationPeriodicVestingAcc(t *testing.T) { types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to undelegate all vesting coins at the beginning of vesting pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) @@ -534,7 +534,7 @@ func TestGetVestedCoinsPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require no coins are vested plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -550,7 +550,7 @@ func TestGetVestingCoinsPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require all coins vesting at the beginning of the schedule plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -566,7 +566,7 @@ func TestSpendableCoinsPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require that all coins are locked in the beginning of the vesting // schedule @@ -590,7 +590,7 @@ func TestTrackDelegationPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to delegate all vesting coins plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -618,7 +618,7 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(1000 * 24 * time.Hour) - bacc, origCoins := createAccount() + bacc, origCoins := initBaseAccount() // require the ability to undelegate all vesting coins plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) @@ -736,11 +736,7 @@ func TestGenesisAccountValidate(t *testing.T) { } func TestContinuousVestingAccountMarshal(t *testing.T) { - pubkey := secp256k1.GenPrivKey().PubKey() - addr := sdk.AccAddress(pubkey.Address()) - coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) - + baseAcc, coins := initBaseAccount() baseVesting := types.NewBaseVestingAccount(baseAcc, coins, time.Now().Unix()) acc := types.NewContinuousVestingAccountRaw(baseVesting, baseVesting.EndTime) @@ -758,11 +754,7 @@ func TestContinuousVestingAccountMarshal(t *testing.T) { } func TestPeriodicVestingAccountMarshal(t *testing.T) { - pubkey := secp256k1.GenPrivKey().PubKey() - addr := sdk.AccAddress(pubkey.Address()) - coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) - + baseAcc, coins := initBaseAccount() acc := types.NewPeriodicVestingAccount(baseAcc, coins, time.Now().Unix(), types.Periods{types.Period{3600, coins}}) bz, err := app.AccountKeeper.MarshalAccount(acc) @@ -779,11 +771,7 @@ func TestPeriodicVestingAccountMarshal(t *testing.T) { } func TestDelayedVestingAccountMarshal(t *testing.T) { - pubkey := secp256k1.GenPrivKey().PubKey() - addr := sdk.AccAddress(pubkey.Address()) - coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) - + baseAcc, coins := initBaseAccount() acc := types.NewDelayedVestingAccount(baseAcc, coins, time.Now().Unix()) bz, err := app.AccountKeeper.MarshalAccount(acc) @@ -799,11 +787,7 @@ func TestDelayedVestingAccountMarshal(t *testing.T) { require.NotNil(t, err) } func TestPermanentLockedVestingAccountMarshal(t *testing.T) { - pubkey := secp256k1.GenPrivKey().PubKey() - addr := sdk.AccAddress(pubkey.Address()) - coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) - + baseAcc, coins := initBaseAccount() acc := types.NewPermanentLockedVestingAccount(baseAcc, coins) bz, err := app.AccountKeeper.MarshalAccount(acc) @@ -819,7 +803,7 @@ func TestPermanentLockedVestingAccountMarshal(t *testing.T) { require.NotNil(t, err) } -func createAccount() (*authtypes.BaseAccount, sdk.Coins) { +func initBaseAccount() (*authtypes.BaseAccount, sdk.Coins) { _, _, addr := testdata.KeyTestPubAddr() origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} bacc := authtypes.NewBaseAccountWithAddress(addr) From 72762444d4c1eea3a6b3043a2ce46a1cecc45e42 Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:23:07 +0200 Subject: [PATCH 13/14] Comments --- docs/core/proto-docs.md | 36 +++--- proto/cosmos/vesting/v1beta1/vesting.proto | 4 +- x/auth/vesting/exported/exported.go | 3 +- x/auth/vesting/types/vesting.pb.go | 122 ++++++++++----------- x/auth/vesting/types/vesting_account.go | 44 ++++---- 5 files changed, 107 insertions(+), 102 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index d3942160b6f8..92887dc08130 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -581,7 +581,7 @@ - [DelayedVestingAccount](#cosmos.vesting.v1beta1.DelayedVestingAccount) - [Period](#cosmos.vesting.v1beta1.Period) - [PeriodicVestingAccount](#cosmos.vesting.v1beta1.PeriodicVestingAccount) - - [PermanentLockedVestingAccount](#cosmos.vesting.v1beta1.PermanentLockedVestingAccount) + - [PermanentLockedAccount](#cosmos.vesting.v1beta1.PermanentLockedAccount) - [Scalar Value Types](#scalar-value-types) @@ -5392,23 +5392,6 @@ QueryVotesResponse is the response type for the Query/Votes RPC method. - - - -### PermanentLockedVestingAccount -PermanentLockedVestingAccount implements the VestingAccount interface. It does -not ever release coins, locking them indefinitely. Coins in this account can -still be used for delegating and for governance votes even while locked. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `base_vesting_account` | [BaseVestingAccount](#cosmos.vesting.v1beta1.BaseVestingAccount) | | | - - - - - @@ -8210,6 +8193,23 @@ periodically vests by unlocking coins during each specified period. + + + +### PermanentLockedAccount +PermanentLockedAccount implements the VestingAccount interface. It does +not ever release coins, locking them indefinitely. Coins in this account can +still be used for delegating and for governance votes even while locked. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `base_vesting_account` | [BaseVestingAccount](#cosmos.vesting.v1beta1.BaseVestingAccount) | | | + + + + + diff --git a/proto/cosmos/vesting/v1beta1/vesting.proto b/proto/cosmos/vesting/v1beta1/vesting.proto index 44e4044fc49c..26e786831e4c 100644 --- a/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/proto/cosmos/vesting/v1beta1/vesting.proto @@ -72,10 +72,10 @@ message PeriodicVestingAccount { repeated Period vesting_periods = 3 [(gogoproto.moretags) = "yaml:\"vesting_periods\"", (gogoproto.nullable) = false]; } -// PermanentLockedVestingAccount implements the VestingAccount interface. It does +// PermanentLockedAccount implements the VestingAccount interface. It does // not ever release coins, locking them indefinitely. Coins in this account can // still be used for delegating and for governance votes even while locked. -message PermanentLockedVestingAccount { +message PermanentLockedAccount { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; diff --git a/x/auth/vesting/exported/exported.go b/x/auth/vesting/exported/exported.go index f47d24ae9eb1..858e53ed4f98 100644 --- a/x/auth/vesting/exported/exported.go +++ b/x/auth/vesting/exported/exported.go @@ -12,7 +12,8 @@ import ( type VestingAccount interface { types.AccountI - // LockedCoins returns the set of coins that are not spendable (i.e. locked). + // LockedCoins returns the set of coins that are not spendable (i.e. locked), + // defined as the vesting coins that are not delegated. // // To get spendable coins of a vesting account, first the total balance must // be retrieved and the locked tokens can be subtracted from the total balance. diff --git a/x/auth/vesting/types/vesting.pb.go b/x/auth/vesting/types/vesting.pb.go index be7e728d4f00..783917097058 100644 --- a/x/auth/vesting/types/vesting.pb.go +++ b/x/auth/vesting/types/vesting.pb.go @@ -238,24 +238,24 @@ func (m *PeriodicVestingAccount) XXX_DiscardUnknown() { var xxx_messageInfo_PeriodicVestingAccount proto.InternalMessageInfo -// PermanentLockedVestingAccount implements the VestingAccount interface. It does +// PermanentLockedAccount implements the VestingAccount interface. It does // not ever release coins, locking them indefinitely. Coins in this account can // still be used for delegating and for governance votes even while locked. -type PermanentLockedVestingAccount struct { +type PermanentLockedAccount struct { *BaseVestingAccount `protobuf:"bytes,1,opt,name=base_vesting_account,json=baseVestingAccount,proto3,embedded=base_vesting_account" json:"base_vesting_account,omitempty"` } -func (m *PermanentLockedVestingAccount) Reset() { *m = PermanentLockedVestingAccount{} } -func (*PermanentLockedVestingAccount) ProtoMessage() {} -func (*PermanentLockedVestingAccount) Descriptor() ([]byte, []int) { +func (m *PermanentLockedAccount) Reset() { *m = PermanentLockedAccount{} } +func (*PermanentLockedAccount) ProtoMessage() {} +func (*PermanentLockedAccount) Descriptor() ([]byte, []int) { return fileDescriptor_89e80273ca606d6e, []int{5} } -func (m *PermanentLockedVestingAccount) XXX_Unmarshal(b []byte) error { +func (m *PermanentLockedAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PermanentLockedVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PermanentLockedAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PermanentLockedVestingAccount.Marshal(b, m, deterministic) + return xxx_messageInfo_PermanentLockedAccount.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -265,17 +265,17 @@ func (m *PermanentLockedVestingAccount) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *PermanentLockedVestingAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_PermanentLockedVestingAccount.Merge(m, src) +func (m *PermanentLockedAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_PermanentLockedAccount.Merge(m, src) } -func (m *PermanentLockedVestingAccount) XXX_Size() int { +func (m *PermanentLockedAccount) XXX_Size() int { return m.Size() } -func (m *PermanentLockedVestingAccount) XXX_DiscardUnknown() { - xxx_messageInfo_PermanentLockedVestingAccount.DiscardUnknown(m) +func (m *PermanentLockedAccount) XXX_DiscardUnknown() { + xxx_messageInfo_PermanentLockedAccount.DiscardUnknown(m) } -var xxx_messageInfo_PermanentLockedVestingAccount proto.InternalMessageInfo +var xxx_messageInfo_PermanentLockedAccount proto.InternalMessageInfo func init() { proto.RegisterType((*BaseVestingAccount)(nil), "cosmos.vesting.v1beta1.BaseVestingAccount") @@ -283,7 +283,7 @@ func init() { proto.RegisterType((*DelayedVestingAccount)(nil), "cosmos.vesting.v1beta1.DelayedVestingAccount") proto.RegisterType((*Period)(nil), "cosmos.vesting.v1beta1.Period") proto.RegisterType((*PeriodicVestingAccount)(nil), "cosmos.vesting.v1beta1.PeriodicVestingAccount") - proto.RegisterType((*PermanentLockedVestingAccount)(nil), "cosmos.vesting.v1beta1.PermanentLockedVestingAccount") + proto.RegisterType((*PermanentLockedAccount)(nil), "cosmos.vesting.v1beta1.PermanentLockedAccount") } func init() { @@ -291,46 +291,46 @@ func init() { } var fileDescriptor_89e80273ca606d6e = []byte{ - // 611 bytes of a gzipped FileDescriptorProto + // 609 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0x3f, 0x6f, 0xd3, 0x40, - 0x18, 0xc6, 0x7d, 0x4d, 0x08, 0xe5, 0x0a, 0xfd, 0x63, 0xda, 0x60, 0x2a, 0x61, 0x47, 0x16, 0x43, - 0x84, 0x84, 0x43, 0x0b, 0x53, 0x37, 0x5c, 0x84, 0x54, 0xb5, 0x43, 0x65, 0x21, 0x06, 0x96, 0xe8, - 0x6c, 0x1f, 0xae, 0xd5, 0xf8, 0x2e, 0xf2, 0x5d, 0x2a, 0xf2, 0x01, 0x90, 0x90, 0x2a, 0x24, 0x90, - 0x18, 0x18, 0xbb, 0xb0, 0xf0, 0x21, 0x98, 0x3b, 0x46, 0x4c, 0x4c, 0x01, 0x25, 0xdf, 0x20, 0x9f, - 0x00, 0xf9, 0xee, 0xec, 0x14, 0x17, 0x88, 0xca, 0x00, 0x62, 0x4a, 0xde, 0x7b, 0xdf, 0xf7, 0xb9, - 0xdf, 0x7b, 0x7e, 0x4e, 0x07, 0x6f, 0x07, 0x94, 0x25, 0x94, 0xb5, 0x8e, 0x30, 0xe3, 0x31, 0x89, - 0x5a, 0x47, 0x1b, 0x3e, 0xe6, 0x68, 0x23, 0x8f, 0x9d, 0x6e, 0x4a, 0x39, 0xd5, 0xeb, 0xb2, 0xca, - 0xc9, 0x57, 0x55, 0xd5, 0xfa, 0x6a, 0x44, 0x23, 0x2a, 0x4a, 0x5a, 0xd9, 0x3f, 0x59, 0xbd, 0x6e, - 0x2a, 0x4d, 0x1f, 0x31, 0x5c, 0x08, 0x06, 0x34, 0x26, 0xa5, 0x3c, 0xea, 0xf1, 0x83, 0x22, 0x9f, - 0x05, 0x32, 0x6f, 0x7f, 0xae, 0x42, 0xdd, 0x45, 0x0c, 0x3f, 0x95, 0xbb, 0x3d, 0x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x42, 0xa6, 0x50, 0xd2, 0x3b, 0x55, + 0x41, 0xf3, 0x61, 0x01, 0xd6, 0x25, 0x4d, 0x1c, 0xfc, 0x2f, 0x1f, 0x55, 0x8f, 0xe0, 0x4a, 0x0e, + 0xd5, 0x13, 0xec, 0x4c, 0x5d, 0x75, 0xf3, 0x57, 0x50, 0xb2, 0x45, 0xd7, 0x54, 0xd7, 0xab, 0x2e, + 0xe5, 0x4b, 0x22, 0xb6, 0xb7, 0xac, 0x76, 0x64, 0x3a, 0x3b, 0xf3, 0xd5, 0x5e, 0x01, 0x31, 0xa7, + 0x04, 0x11, 0x4c, 0xf8, 0x01, 0x0d, 0x0e, 0x71, 0xf8, 0x4f, 0xec, 0xe3, 0xee, 0x9f, 0x8e, 0x4d, + 0x30, 0x1c, 0x9b, 0xe0, 0xdb, 0xd8, 0x04, 0x6f, 0x26, 0xa6, 0x36, 0x9c, 0x98, 0xda, 0x97, 0x89, + 0xa9, 0x3d, 0xdb, 0xfa, 0xad, 0x05, 0x5e, 0xa8, 0xe7, 0x42, 0xbd, 0x53, 0xc2, 0x11, 0x7e, 0x4d, + 0x3c, 0x18, 0xf7, 0xbe, 0x07, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0xd5, 0x07, 0xc6, 0x06, 0x00, + 0x00, } func (m *BaseVestingAccount) Marshal() (dAtA []byte, err error) { @@ -586,7 +586,7 @@ func (m *PeriodicVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *PermanentLockedVestingAccount) Marshal() (dAtA []byte, err error) { +func (m *PermanentLockedAccount) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -596,12 +596,12 @@ func (m *PermanentLockedVestingAccount) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PermanentLockedVestingAccount) MarshalTo(dAtA []byte) (int, error) { +func (m *PermanentLockedAccount) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PermanentLockedVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PermanentLockedAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -735,7 +735,7 @@ func (m *PeriodicVestingAccount) Size() (n int) { return n } -func (m *PermanentLockedVestingAccount) Size() (n int) { +func (m *PermanentLockedAccount) Size() (n int) { if m == nil { return 0 } @@ -1394,7 +1394,7 @@ func (m *PeriodicVestingAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { +func (m *PermanentLockedAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1417,10 +1417,10 @@ func (m *PermanentLockedVestingAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PermanentLockedVestingAccount: wiretype end group for non-group") + return fmt.Errorf("proto: PermanentLockedAccount: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PermanentLockedVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 3e3f3af96a65..b4e35835cc83 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -261,7 +261,8 @@ func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coi return cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime)) } -// LockedCoins returns the set of coins that are not spendable (i.e. locked). +// LockedCoins returns the set of coins that are not spendable (i.e. locked), +// defined as the vesting coins that are not delegated. func (cva ContinuousVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { return cva.BaseVestingAccount.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime)) } @@ -386,7 +387,8 @@ func (pva PeriodicVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins return pva.OriginalVesting.Sub(pva.GetVestedCoins(blockTime)) } -// LockedCoins returns the set of coins that are not spendable (i.e. locked). +// LockedCoins returns the set of coins that are not spendable (i.e. locked), +// defined as the vesting coins that are not delegated. func (pva PeriodicVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { return pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(blockTime)) } @@ -496,7 +498,8 @@ func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins return dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime)) } -// LockedCoins returns the set of coins that are not spendable (i.e. locked). +// LockedCoins returns the set of coins that are not spendable (i.e. locked), +// defined as the vesting coins that are not delegated. func (dva DelayedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { return dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(blockTime)) } @@ -526,57 +529,58 @@ func (dva DelayedVestingAccount) String() string { //----------------------------------------------------------------------------- // Permanent Locked Vesting Account -var _ vestexported.VestingAccount = (*PermanentLockedVestingAccount)(nil) -var _ authtypes.GenesisAccount = (*PermanentLockedVestingAccount)(nil) +var _ vestexported.VestingAccount = (*PermanentLockedAccount)(nil) +var _ authtypes.GenesisAccount = (*PermanentLockedAccount)(nil) -// NewPermanentLockedVestingAccount returns a PermanentLockedVestingAccount -func NewPermanentLockedVestingAccount(baseAcc *authtypes.BaseAccount, coins sdk.Coins) *PermanentLockedVestingAccount { +// NewPermanentLockedAccount returns a PermanentLockedAccount +func NewPermanentLockedAccount(baseAcc *authtypes.BaseAccount, coins sdk.Coins) *PermanentLockedAccount { baseVestingAcc := &BaseVestingAccount{ BaseAccount: baseAcc, OriginalVesting: coins, - EndTime: -1, // ensure EndTime is set to -1, as PermanentLockedVestingAccount's do not have an EndTime + EndTime: 0, // ensure EndTime is set to 0, as PermanentLockedAccount's do not have an EndTime } - return &PermanentLockedVestingAccount{baseVestingAcc} + return &PermanentLockedAccount{baseVestingAcc} } // GetVestedCoins returns the total amount of vested coins for a permanent locked vesting // account. All coins are only vested once the schedule has elapsed. -func (plva PermanentLockedVestingAccount) GetVestedCoins(_ time.Time) sdk.Coins { +func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins { return nil } // GetVestingCoins returns the total number of vesting coins for a permanent locked // vesting account. -func (plva PermanentLockedVestingAccount) GetVestingCoins(_ time.Time) sdk.Coins { +func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins { return plva.OriginalVesting } -// LockedCoins returns the set of coins that are not spendable (i.e. locked). -func (plva PermanentLockedVestingAccount) LockedCoins(_ time.Time) sdk.Coins { +// LockedCoins returns the set of coins that are not spendable (i.e. locked), +// defined as the vesting coins that are not delegated. +func (plva PermanentLockedAccount) LockedCoins(_ time.Time) sdk.Coins { return plva.BaseVestingAccount.LockedCoinsFromVesting(plva.OriginalVesting) } // TrackDelegation tracks a desired delegation amount by setting the appropriate // values for the amount of delegated vesting, delegated free, and reducing the // overall amount of base coins. -func (plva *PermanentLockedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) { +func (plva *PermanentLockedAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) { plva.BaseVestingAccount.TrackDelegation(balance, plva.OriginalVesting, amount) } // GetStartTime returns zero since a permanent locked vesting account has no start time. -func (plva PermanentLockedVestingAccount) GetStartTime() int64 { +func (plva PermanentLockedAccount) GetStartTime() int64 { return 0 } -// GetEndTime returns a vesting account's end time, we return -1 to denote that +// GetEndTime returns a vesting account's end time, we return 0 to denote that // a permanently locked vesting account has no end time. -func (plva PermanentLockedVestingAccount) GetEndTime() int64 { - return -1 +func (plva PermanentLockedAccount) GetEndTime() int64 { + return 0 } // Validate checks for errors on the account fields -func (plva PermanentLockedVestingAccount) Validate() error { +func (plva PermanentLockedAccount) Validate() error { if plva.EndTime > 0 { return errors.New("permanently vested accounts cannot have an end-time") } @@ -584,7 +588,7 @@ func (plva PermanentLockedVestingAccount) Validate() error { return plva.BaseVestingAccount.Validate() } -func (plva PermanentLockedVestingAccount) String() string { +func (plva PermanentLockedAccount) String() string { out, _ := plva.MarshalYAML() return out.(string) } From d202bd35a0a0ef7cc669c0fff3030e0374b3cbe0 Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Wed, 21 Apr 2021 16:24:59 +0200 Subject: [PATCH 14/14] Fix build after rename --- x/auth/vesting/types/codec.go | 8 +++--- x/auth/vesting/types/vesting_account_test.go | 30 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/x/auth/vesting/types/codec.go b/x/auth/vesting/types/codec.go index 3dd30702392b..6a4b795107d8 100644 --- a/x/auth/vesting/types/codec.go +++ b/x/auth/vesting/types/codec.go @@ -17,7 +17,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil) cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil) cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount", nil) - cdc.RegisterConcrete(&PermanentLockedVestingAccount{}, "cosmos-sdk/PermanentLockedVestingAccount", nil) + cdc.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount", nil) } // RegisterInterface associates protoName with AccountI and VestingAccount @@ -29,7 +29,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &ContinuousVestingAccount{}, &DelayedVestingAccount{}, &PeriodicVestingAccount{}, - &PermanentLockedVestingAccount{}, + &PermanentLockedAccount{}, ) registry.RegisterImplementations( @@ -38,7 +38,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &DelayedVestingAccount{}, &ContinuousVestingAccount{}, &PeriodicVestingAccount{}, - &PermanentLockedVestingAccount{}, + &PermanentLockedAccount{}, ) registry.RegisterImplementations( @@ -47,7 +47,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &DelayedVestingAccount{}, &ContinuousVestingAccount{}, &PeriodicVestingAccount{}, - &PermanentLockedVestingAccount{}, + &PermanentLockedAccount{}, ) registry.RegisterImplementations( diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 330e8be15be8..979b0221292b 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -537,7 +537,7 @@ func TestGetVestedCoinsPermLockedVestingAcc(t *testing.T) { bacc, origCoins := initBaseAccount() // require no coins are vested - plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva := types.NewPermanentLockedAccount(bacc, origCoins) vestedCoins := plva.GetVestedCoins(now) require.Nil(t, vestedCoins) @@ -553,7 +553,7 @@ func TestGetVestingCoinsPermLockedVestingAcc(t *testing.T) { bacc, origCoins := initBaseAccount() // require all coins vesting at the beginning of the schedule - plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva := types.NewPermanentLockedAccount(bacc, origCoins) vestingCoins := plva.GetVestingCoins(now) require.Equal(t, origCoins, vestingCoins) @@ -570,7 +570,7 @@ func TestSpendableCoinsPermLockedVestingAcc(t *testing.T) { // require that all coins are locked in the beginning of the vesting // schedule - plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva := types.NewPermanentLockedAccount(bacc, origCoins) lockedCoins := plva.LockedCoins(now) require.True(t, lockedCoins.IsEqual(origCoins)) @@ -593,19 +593,19 @@ func TestTrackDelegationPermLockedVestingAcc(t *testing.T) { bacc, origCoins := initBaseAccount() // require the ability to delegate all vesting coins - plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva := types.NewPermanentLockedAccount(bacc, origCoins) plva.TrackDelegation(now, origCoins, origCoins) require.Equal(t, origCoins, plva.DelegatedVesting) require.Nil(t, plva.DelegatedFree) // require the ability to delegate all vested coins at endTime - plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva = types.NewPermanentLockedAccount(bacc, origCoins) plva.TrackDelegation(endTime, origCoins, origCoins) require.Equal(t, origCoins, plva.DelegatedVesting) require.Nil(t, plva.DelegatedFree) // require no modifications when delegation amount is zero or not enough funds - plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva = types.NewPermanentLockedAccount(bacc, origCoins) require.Panics(t, func() { plva.TrackDelegation(endTime, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 1000000)}) @@ -621,21 +621,21 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { bacc, origCoins := initBaseAccount() // require the ability to undelegate all vesting coins - plva := types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva := types.NewPermanentLockedAccount(bacc, origCoins) plva.TrackDelegation(now, origCoins, origCoins) plva.TrackUndelegation(origCoins) require.Nil(t, plva.DelegatedFree) require.Nil(t, plva.DelegatedVesting) // require the ability to undelegate all vesting coins at endTime - plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva = types.NewPermanentLockedAccount(bacc, origCoins) plva.TrackDelegation(endTime, origCoins, origCoins) plva.TrackUndelegation(origCoins) require.Nil(t, plva.DelegatedFree) require.Nil(t, plva.DelegatedVesting) // require no modifications when the undelegation amount is zero - plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva = types.NewPermanentLockedAccount(bacc, origCoins) require.Panics(t, func() { plva.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 0)}) }) @@ -643,7 +643,7 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { require.Nil(t, plva.DelegatedVesting) // delegate to two validators - plva = types.NewPermanentLockedVestingAccount(bacc, origCoins) + plva = types.NewPermanentLockedAccount(bacc, origCoins) plva.TrackDelegation(now, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) plva.TrackDelegation(now, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) @@ -716,12 +716,12 @@ func TestGenesisAccountValidate(t *testing.T) { }, { "valid permanent locked vesting account", - types.NewPermanentLockedVestingAccount(baseAcc, initialVesting), + types.NewPermanentLockedAccount(baseAcc, initialVesting), false, }, { "invalid positive end time for permanently locked vest account", - &types.PermanentLockedVestingAccount{BaseVestingAccount: baseVestingWithCoins}, + &types.PermanentLockedAccount{BaseVestingAccount: baseVestingWithCoins}, true, }, } @@ -786,16 +786,16 @@ func TestDelayedVestingAccountMarshal(t *testing.T) { _, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2]) require.NotNil(t, err) } -func TestPermanentLockedVestingAccountMarshal(t *testing.T) { +func TestPermanentLockedAccountMarshal(t *testing.T) { baseAcc, coins := initBaseAccount() - acc := types.NewPermanentLockedVestingAccount(baseAcc, coins) + acc := types.NewPermanentLockedAccount(baseAcc, coins) bz, err := app.AccountKeeper.MarshalAccount(acc) require.Nil(t, err) acc2, err := app.AccountKeeper.UnmarshalAccount(bz) require.Nil(t, err) - require.IsType(t, &types.PermanentLockedVestingAccount{}, acc2) + require.IsType(t, &types.PermanentLockedAccount{}, acc2) require.Equal(t, acc.String(), acc2.String()) // error on bad bytes