From d48c561db4e2c60a157605964f7760a938a291b6 Mon Sep 17 00:00:00 2001 From: kenta-elys Date: Wed, 27 Sep 2023 06:42:53 +0000 Subject: [PATCH] chore: update proto buf to do error handling in CLI side --- proto/elys/commitment/tx.proto | 6 +- .../client/cli/tx_update_vesting_info.go | 49 +++-- .../keeper/msg_server_update_vesting_info.go | 28 +-- .../msg_server_update_vesting_info_test.go | 12 +- x/commitment/types/keys.go | 9 + .../types/message_update_vesting_info.go | 2 +- x/commitment/types/tx.pb.go | 194 +++++++----------- 7 files changed, 131 insertions(+), 169 deletions(-) diff --git a/proto/elys/commitment/tx.proto b/proto/elys/commitment/tx.proto index b437c9228..59bf4431c 100644 --- a/proto/elys/commitment/tx.proto +++ b/proto/elys/commitment/tx.proto @@ -78,9 +78,9 @@ message MsgUpdateVestingInfo { string baseDenom = 2; string vestingDenom = 3; string epochIdentifier = 4; - string numEpochs = 5; - string vestNowFactor = 6; - string numMaxVestings = 7; + int64 numEpochs = 5; + int64 vestNowFactor = 6; + int64 numMaxVestings = 7; } message MsgUpdateVestingInfoResponse {} diff --git a/x/commitment/client/cli/tx_update_vesting_info.go b/x/commitment/client/cli/tx_update_vesting_info.go index 741b9123d..ee6f15e8f 100644 --- a/x/commitment/client/cli/tx_update_vesting_info.go +++ b/x/commitment/client/cli/tx_update_vesting_info.go @@ -9,7 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/elys-network/elys/x/commitment/types" "github.com/spf13/cobra" @@ -43,32 +45,32 @@ func CmdUpdateVestingInfo() *cobra.Command { return err } - argBaseDenom, err := cmd.Flags().GetString("base-denom") + argBaseDenom, err := cmd.Flags().GetString(types.BaseDenom) if err != nil { return err } - argVestingDenom, err := cmd.Flags().GetString("vesting-denom") + argVestingDenom, err := cmd.Flags().GetString(types.VestingDenom) if err != nil { return err } - argEpochIdentifier, err := cmd.Flags().GetString("epoch-identifier") + argEpochIdentifier, err := cmd.Flags().GetString(types.EpochIdentifier) if err != nil { return err } - argNumEpochs, err := cmd.Flags().GetString("num-epochs") + argNumEpochs, err := cmd.Flags().GetString(types.NumEpochs) if err != nil { return err } - argVestNowFactor, err := cmd.Flags().GetString("vest-now-factor") + argVestNowFactor, err := cmd.Flags().GetString(types.VestNowFactor) if err != nil { return err } - argNumMaxVestings, err := cmd.Flags().GetString("num-max-vestings") + argNumMaxVestings, err := cmd.Flags().GetString(types.NumMaxVestings) if err != nil { return err } @@ -78,15 +80,30 @@ func CmdUpdateVestingInfo() *cobra.Command { return errors.New("signer address is missing") } - govAddress := sdk.AccAddress(address.Module("gov")) + numEpochs, err := strconv.ParseInt(argNumEpochs, 10, 64) + if err != nil { + return sdkerrors.Wrapf(govtypes.ErrInvalidProposalMsg, "invalid proposal; %d", argNumEpochs) + } + + vestNowFactor, err := strconv.ParseInt(argVestNowFactor, 10, 64) + if err != nil { + return sdkerrors.Wrapf(govtypes.ErrInvalidProposalMsg, "invalid proposal; %d", argVestNowFactor) + } + + maxVestings, err := strconv.ParseInt(argNumMaxVestings, 10, 64) + if err != nil { + return sdkerrors.Wrapf(govtypes.ErrInvalidProposalMsg, "invalid proposal; %d", argNumMaxVestings) + } + + govAddress := sdk.AccAddress(address.Module(govtypes.ModuleName)) msg := types.NewMsgUpdateVestingInfo( govAddress.String(), argBaseDenom, argVestingDenom, argEpochIdentifier, - argNumEpochs, - argVestNowFactor, - argNumMaxVestings, + numEpochs, + vestNowFactor, + maxVestings, ) if err := msg.ValidateBasic(); err != nil { return err @@ -111,12 +128,12 @@ func CmdUpdateVestingInfo() *cobra.Command { }, } - cmd.Flags().String("base-denom", "", "base denom (string)") - cmd.Flags().String("vesting-denom", "", "vesting-denom (string)") - cmd.Flags().String("epoch-identifier", "", "epoch-identifier (string)") - cmd.Flags().String("num-epochs", "", "num-epochs (int64)") - cmd.Flags().String("vest-now-factor", "", "vest-now-factor (decimal)") - cmd.Flags().String("num-max-vestings", "", "num-max-vestings (int64)") + cmd.Flags().String(types.BaseDenom, "", "base denom") + cmd.Flags().String(types.VestingDenom, "", "vesting-denom") + cmd.Flags().String(types.EpochIdentifier, "", "epoch-identifier") + cmd.Flags().String(types.NumEpochs, "", "num-epochs") + cmd.Flags().String(types.VestNowFactor, "", "vest-now-factor") + cmd.Flags().String(types.NumMaxVestings, "", "num-max-vestings") cmd.Flags().String(cli.FlagTitle, "", "title of proposal") cmd.Flags().String(cli.FlagSummary, "", "summary of proposal") cmd.Flags().String(cli.FlagMetadata, "", "metadata of proposal") diff --git a/x/commitment/keeper/msg_server_update_vesting_info.go b/x/commitment/keeper/msg_server_update_vesting_info.go index 00cc45cb5..107eb178b 100644 --- a/x/commitment/keeper/msg_server_update_vesting_info.go +++ b/x/commitment/keeper/msg_server_update_vesting_info.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "strconv" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -17,21 +16,6 @@ func (k msgServer) UpdateVestingInfo(goCtx context.Context, msg *types.MsgUpdate return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } - numEpochs, err := strconv.ParseInt(msg.NumEpochs, 10, 64) - if err != nil { - return nil, sdkerrors.Wrapf(govtypes.ErrInvalidProposalMsg, "invalid proposal; %s", msg.NumEpochs) - } - - vestNowFactor, err := strconv.ParseInt(msg.VestNowFactor, 10, 64) - if err != nil { - return nil, sdkerrors.Wrapf(govtypes.ErrInvalidProposalMsg, "invalid proposal; %s", msg.VestNowFactor) - } - - maxVestings, err := strconv.ParseInt(msg.NumMaxVestings, 10, 64) - if err != nil { - return nil, sdkerrors.Wrapf(govtypes.ErrInvalidProposalMsg, "invalid proposal; %s", msg.NumMaxVestings) - } - params := k.GetParams(ctx) vestingInfo, index := k.GetVestingInfo(ctx, msg.BaseDenom) if vestingInfo == nil { @@ -39,18 +23,18 @@ func (k msgServer) UpdateVestingInfo(goCtx context.Context, msg *types.MsgUpdate BaseDenom: msg.BaseDenom, VestingDenom: msg.VestingDenom, EpochIdentifier: msg.EpochIdentifier, - NumEpochs: numEpochs, - VestNowFactor: sdk.NewInt(vestNowFactor), - NumMaxVestings: maxVestings, + NumEpochs: msg.NumEpochs, + VestNowFactor: sdk.NewInt(msg.VestNowFactor), + NumMaxVestings: msg.NumMaxVestings, } params.VestingInfos = append(params.VestingInfos, vestingInfo) } else { params.VestingInfos[index].BaseDenom = msg.BaseDenom params.VestingInfos[index].VestingDenom = msg.VestingDenom params.VestingInfos[index].EpochIdentifier = msg.EpochIdentifier - params.VestingInfos[index].NumEpochs = numEpochs - params.VestingInfos[index].VestNowFactor = sdk.NewInt(vestNowFactor) - params.VestingInfos[index].NumMaxVestings = maxVestings + params.VestingInfos[index].NumEpochs = msg.NumEpochs + params.VestingInfos[index].VestNowFactor = sdk.NewInt(msg.VestNowFactor) + params.VestingInfos[index].NumMaxVestings = msg.NumMaxVestings } // store params diff --git a/x/commitment/keeper/msg_server_update_vesting_info_test.go b/x/commitment/keeper/msg_server_update_vesting_info_test.go index 66683811e..a6071fa4b 100644 --- a/x/commitment/keeper/msg_server_update_vesting_info_test.go +++ b/x/commitment/keeper/msg_server_update_vesting_info_test.go @@ -33,9 +33,9 @@ func TestAddVestingInfo(t *testing.T) { BaseDenom: "test_denom", VestingDenom: "test_denom", EpochIdentifier: "day", - NumEpochs: "10", - VestNowFactor: "10", - NumMaxVestings: "10", + NumEpochs: 10, + VestNowFactor: 10, + NumMaxVestings: 10, } _, err := msgServer.UpdateVestingInfo(ctx, &msg) require.NoError(t, err) @@ -79,9 +79,9 @@ func TestUpdateVestingInfo(t *testing.T) { BaseDenom: "test_denom", VestingDenom: "test_denom", EpochIdentifier: "day", - NumEpochs: "10", - VestNowFactor: "10", - NumMaxVestings: "10", + NumEpochs: 10, + VestNowFactor: 10, + NumMaxVestings: 10, } _, err := msgServer.UpdateVestingInfo(ctx, &msg) require.NoError(t, err) diff --git a/x/commitment/types/keys.go b/x/commitment/types/keys.go index 95ab10139..a3e61a447 100644 --- a/x/commitment/types/keys.go +++ b/x/commitment/types/keys.go @@ -14,6 +14,15 @@ const ( MemStoreKey = "mem_commitment" ) +const ( + BaseDenom = "base-denom" + VestingDenom = "vesting-denom" + EpochIdentifier = "epoch-identifier" + NumEpochs = "num-epochs" + VestNowFactor = "vest-now-factor" + NumMaxVestings = "num-max-vestings" +) + func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/commitment/types/message_update_vesting_info.go b/x/commitment/types/message_update_vesting_info.go index 78769ebf0..5e0b0af27 100644 --- a/x/commitment/types/message_update_vesting_info.go +++ b/x/commitment/types/message_update_vesting_info.go @@ -9,7 +9,7 @@ const TypeMsgUpdateVestingInfo = "update_vesting_info" var _ sdk.Msg = &MsgUpdateVestingInfo{} -func NewMsgUpdateVestingInfo(creator string, baseDenom string, vestingDenom string, epochIdentifier string, numEpochs string, vestNowFactor string, numMaxVestings string) *MsgUpdateVestingInfo { +func NewMsgUpdateVestingInfo(creator string, baseDenom string, vestingDenom string, epochIdentifier string, numEpochs int64, vestNowFactor int64, numMaxVestings int64) *MsgUpdateVestingInfo { return &MsgUpdateVestingInfo{ Authority: creator, BaseDenom: baseDenom, diff --git a/x/commitment/types/tx.pb.go b/x/commitment/types/tx.pb.go index e315425b9..165985d8d 100644 --- a/x/commitment/types/tx.pb.go +++ b/x/commitment/types/tx.pb.go @@ -657,9 +657,9 @@ type MsgUpdateVestingInfo struct { BaseDenom string `protobuf:"bytes,2,opt,name=baseDenom,proto3" json:"baseDenom,omitempty"` VestingDenom string `protobuf:"bytes,3,opt,name=vestingDenom,proto3" json:"vestingDenom,omitempty"` EpochIdentifier string `protobuf:"bytes,4,opt,name=epochIdentifier,proto3" json:"epochIdentifier,omitempty"` - NumEpochs string `protobuf:"bytes,5,opt,name=numEpochs,proto3" json:"numEpochs,omitempty"` - VestNowFactor string `protobuf:"bytes,6,opt,name=vestNowFactor,proto3" json:"vestNowFactor,omitempty"` - NumMaxVestings string `protobuf:"bytes,7,opt,name=numMaxVestings,proto3" json:"numMaxVestings,omitempty"` + NumEpochs int64 `protobuf:"varint,5,opt,name=numEpochs,proto3" json:"numEpochs,omitempty"` + VestNowFactor int64 `protobuf:"varint,6,opt,name=vestNowFactor,proto3" json:"vestNowFactor,omitempty"` + NumMaxVestings int64 `protobuf:"varint,7,opt,name=numMaxVestings,proto3" json:"numMaxVestings,omitempty"` } func (m *MsgUpdateVestingInfo) Reset() { *m = MsgUpdateVestingInfo{} } @@ -723,25 +723,25 @@ func (m *MsgUpdateVestingInfo) GetEpochIdentifier() string { return "" } -func (m *MsgUpdateVestingInfo) GetNumEpochs() string { +func (m *MsgUpdateVestingInfo) GetNumEpochs() int64 { if m != nil { return m.NumEpochs } - return "" + return 0 } -func (m *MsgUpdateVestingInfo) GetVestNowFactor() string { +func (m *MsgUpdateVestingInfo) GetVestNowFactor() int64 { if m != nil { return m.VestNowFactor } - return "" + return 0 } -func (m *MsgUpdateVestingInfo) GetNumMaxVestings() string { +func (m *MsgUpdateVestingInfo) GetNumMaxVestings() int64 { if m != nil { return m.NumMaxVestings } - return "" + return 0 } type MsgUpdateVestingInfoResponse struct { @@ -802,47 +802,47 @@ func init() { func init() { proto.RegisterFile("elys/commitment/tx.proto", fileDescriptor_eda78aafe7eb119c) } var fileDescriptor_eda78aafe7eb119c = []byte{ - // 637 bytes of a gzipped FileDescriptorProto + // 639 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcb, 0x6a, 0xdb, 0x40, - 0x14, 0x86, 0xad, 0xdc, 0x4c, 0x0e, 0xb9, 0x34, 0x83, 0x4b, 0x14, 0x25, 0x28, 0xa9, 0xda, 0x86, - 0xb4, 0x10, 0x09, 0xda, 0x37, 0x70, 0xdd, 0x80, 0x29, 0xca, 0xc2, 0xa4, 0x2d, 0x04, 0x0a, 0x95, - 0xe5, 0x89, 0x2c, 0x1c, 0xcd, 0x08, 0xcd, 0x38, 0xb6, 0x97, 0x85, 0x42, 0xe9, 0x65, 0xd1, 0xc7, - 0xca, 0x32, 0xab, 0x52, 0xba, 0x08, 0xc5, 0x7e, 0x91, 0x32, 0x92, 0x3d, 0xb6, 0x14, 0x25, 0xee, - 0xce, 0x59, 0x25, 0x73, 0xfe, 0x7f, 0xce, 0xf9, 0x34, 0xf2, 0xfc, 0x08, 0x54, 0x7c, 0xde, 0x63, - 0x96, 0x4b, 0x83, 0xc0, 0xe7, 0x01, 0x26, 0xdc, 0xe2, 0x5d, 0x33, 0x8c, 0x28, 0xa7, 0x68, 0x5d, - 0x28, 0xe6, 0x58, 0xd1, 0x4a, 0x1e, 0xf5, 0x68, 0xac, 0x59, 0xe2, 0xbf, 0xc4, 0x66, 0x7c, 0x55, - 0x60, 0xdd, 0x66, 0xde, 0xab, 0xd8, 0x77, 0x42, 0x5b, 0x98, 0x30, 0xa4, 0x42, 0xd1, 0x8d, 0xb0, - 0xc3, 0x69, 0xa4, 0x2a, 0x7b, 0xca, 0xc1, 0x72, 0x6d, 0xb4, 0x44, 0x47, 0xb0, 0xe4, 0x04, 0xb4, - 0x4d, 0xb8, 0x3a, 0x27, 0x84, 0xb2, 0x79, 0x79, 0xbd, 0x5b, 0xf8, 0x73, 0xbd, 0xbb, 0xef, 0xf9, - 0xbc, 0xd9, 0xae, 0x8b, 0x71, 0x96, 0x4b, 0x59, 0x40, 0xd9, 0xf0, 0xcf, 0x21, 0x6b, 0xb4, 0x2c, - 0xde, 0x0b, 0x31, 0x33, 0xab, 0x84, 0xd7, 0x86, 0xbb, 0x51, 0x09, 0x16, 0x1b, 0x98, 0xd0, 0x40, - 0x9d,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, - 0xcb, 0xbe, 0xae, 0x5c, 0xf5, 0x75, 0xe5, 0x6f, 0x5f, 0x57, 0x7e, 0x0e, 0xf4, 0xc2, 0xd5, 0x40, - 0x2f, 0xfc, 0x1e, 0xe8, 0x85, 0x53, 0x6b, 0x22, 0x7d, 0x44, 0xcb, 0x43, 0x82, 0x79, 0x87, 0x46, - 0xad, 0x78, 0x61, 0x75, 0x53, 0x5f, 0x3e, 0x22, 0x8a, 0xea, 0x4b, 0xf1, 0x67, 0xcd, 0xcb, 0x7f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x0f, 0x5c, 0x45, 0x19, 0x09, 0x00, 0x00, + 0x14, 0x86, 0x3d, 0xb9, 0x99, 0x1c, 0x72, 0x69, 0x06, 0x97, 0x28, 0x4a, 0x50, 0x5c, 0xb5, 0x0d, + 0x6e, 0x21, 0x12, 0xb4, 0x6f, 0x90, 0xa6, 0x01, 0x53, 0x94, 0x85, 0x49, 0x5b, 0x08, 0x14, 0x2a, + 0xcb, 0x13, 0x59, 0x38, 0x9a, 0x11, 0x9a, 0x71, 0x6c, 0x2f, 0x0b, 0x85, 0xd2, 0xcb, 0xa2, 0x8f, + 0x95, 0x65, 0x56, 0xa5, 0x74, 0x11, 0x8a, 0xfd, 0x22, 0x65, 0x24, 0x5b, 0xb6, 0x14, 0x25, 0xee, + 0xce, 0x59, 0x25, 0x73, 0xfe, 0x7f, 0xce, 0xf9, 0x34, 0xf2, 0xfc, 0x08, 0x14, 0x72, 0xde, 0xe3, + 0xa6, 0xc3, 0x7c, 0xdf, 0x13, 0x3e, 0xa1, 0xc2, 0x14, 0x5d, 0x23, 0x08, 0x99, 0x60, 0x78, 0x5d, + 0x2a, 0xc6, 0x58, 0x51, 0x4b, 0x2e, 0x73, 0x59, 0xa4, 0x99, 0xf2, 0xbf, 0xd8, 0xa6, 0x7f, 0x45, + 0xb0, 0x6e, 0x71, 0xf7, 0x55, 0xe4, 0x3b, 0x61, 0x2d, 0x42, 0x39, 0x56, 0xa0, 0xe8, 0x84, 0xc4, + 0x16, 0x2c, 0x54, 0x50, 0x19, 0x55, 0x96, 0x6b, 0xa3, 0x25, 0x3e, 0x82, 0x25, 0xdb, 0x67, 0x6d, + 0x2a, 0x94, 0x39, 0x29, 0x1c, 0x18, 0x97, 0xd7, 0xbb, 0x85, 0x3f, 0xd7, 0xbb, 0x7b, 0xae, 0x27, + 0x9a, 0xed, 0xba, 0x1c, 0x67, 0x3a, 0x8c, 0xfb, 0x8c, 0x0f, 0xff, 0xec, 0xf3, 0x46, 0xcb, 0x14, + 0xbd, 0x80, 0x70, 0xa3, 0x4a, 0x45, 0x6d, 0xb8, 0x1b, 0x97, 0x60, 0xb1, 0x41, 0x28, 0xf3, 0x95, + 0xf9, 0xa8, 0x7f, 0xbc, 0xd0, 0xb7, 0x60, 0x33, 0x83, 0x52, 0x23, 0x3c, 0x60, 0x94, 0x13, 0xfd, + 0x3b, 0x82, 0x0d, 0x8b, 0xbb, 0x6f, 0xa9, 0x73, 0x1f, 0x40, 0xb7, 0x61, 0xeb, 0x06, 0x4c, 0x16, + 0xf5, 0xbd, 0x27, 0x9a, 0x8d, 0xd0, 0xee, 0xdc, 0x0b, 0xd4, 0x34, 0x4c, 0x82, 0xfa, 0x0d, 0xc1, + 0x03, 0x8b, 0xbb, 0x87, 0x24, 0x60, 0x7c, 0xe6, 0x87, 0xaa, 0x82, 0x92, 0x65, 0x49, 0x40, 0x3f, + 0x21, 0x28, 0x5a, 0xdc, 0x7d, 0x47, 0xb8, 0x98, 0x19, 0xdf, 0x46, 0x74, 0x51, 0x24, 0x42, 0x82, + 0xf5, 0x05, 0xc1, 0xaa, 0xfc, 0xc5, 0xda, 0xd4, 0x21, 0xe7, 0x33, 0x85, 0xdb, 0x84, 0x87, 0x29, + 0x90, 0x04, 0xf1, 0x33, 0x02, 0x18, 0x62, 0x1f, 0xb3, 0xce, 0xcc, 0xf8, 0x4a, 0x80, 0xc7, 0x14, + 0x09, 0xdc, 0x8f, 0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b, 0x9c, 0xb2, 0xa8, 0xcf, 0xa6, + 0x5a, 0x92, 0xf6, 0x07, 0xb0, 0x10, 0xdf, 0xf5, 0xbc, 0x2d, 0x52, 0x51, 0xcb, 0xb7, 0x29, 0x49, + 0x8f, 0x13, 0x80, 0x89, 0xd4, 0xd0, 0x72, 0x5f, 0x4f, 0xa2, 0xab, 0x7b, 0x77, 0xeb, 0x49, 0xd7, + 0x37, 0x50, 0x1c, 0x5d, 0xf4, 0xed, 0xdb, 0x10, 0x8e, 0x59, 0x47, 0x7d, 0x7c, 0x87, 0x98, 0x34, + 0xf3, 0x60, 0xe3, 0xe6, 0xc5, 0x7c, 0x9a, 0xfb, 0xa2, 0xb3, 0x36, 0x75, 0xff, 0xbf, 0x6c, 0xa3, + 0x51, 0x07, 0xd5, 0xcb, 0xbe, 0x86, 0xae, 0xfa, 0x1a, 0xfa, 0xdb, 0xd7, 0xd0, 0xcf, 0x81, 0x56, + 0xb8, 0x1a, 0x68, 0x85, 0xdf, 0x03, 0xad, 0x70, 0x6a, 0x4e, 0xa4, 0x8f, 0x6c, 0xb9, 0x4f, 0x89, + 0xe8, 0xb0, 0xb0, 0x15, 0x2d, 0xcc, 0x6e, 0xea, 0xcb, 0x47, 0x46, 0x51, 0x7d, 0x29, 0xfa, 0xac, + 0x79, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x11, 0xd0, 0x5d, 0x19, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1687,26 +1687,20 @@ func (m *MsgUpdateVestingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.NumMaxVestings) > 0 { - i -= len(m.NumMaxVestings) - copy(dAtA[i:], m.NumMaxVestings) - i = encodeVarintTx(dAtA, i, uint64(len(m.NumMaxVestings))) + if m.NumMaxVestings != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NumMaxVestings)) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x38 } - if len(m.VestNowFactor) > 0 { - i -= len(m.VestNowFactor) - copy(dAtA[i:], m.VestNowFactor) - i = encodeVarintTx(dAtA, i, uint64(len(m.VestNowFactor))) + if m.VestNowFactor != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.VestNowFactor)) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x30 } - if len(m.NumEpochs) > 0 { - i -= len(m.NumEpochs) - copy(dAtA[i:], m.NumEpochs) - i = encodeVarintTx(dAtA, i, uint64(len(m.NumEpochs))) + if m.NumEpochs != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NumEpochs)) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x28 } if len(m.EpochIdentifier) > 0 { i -= len(m.EpochIdentifier) @@ -1991,17 +1985,14 @@ func (m *MsgUpdateVestingInfo) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NumEpochs) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.NumEpochs != 0 { + n += 1 + sovTx(uint64(m.NumEpochs)) } - l = len(m.VestNowFactor) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.VestNowFactor != 0 { + n += 1 + sovTx(uint64(m.VestNowFactor)) } - l = len(m.NumMaxVestings) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.NumMaxVestings != 0 { + n += 1 + sovTx(uint64(m.NumMaxVestings)) } return n } @@ -3565,10 +3556,10 @@ func (m *MsgUpdateVestingInfo) Unmarshal(dAtA []byte) error { m.EpochIdentifier = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NumEpochs", wireType) } - var stringLen uint64 + m.NumEpochs = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3578,29 +3569,16 @@ func (m *MsgUpdateVestingInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NumEpochs |= int64(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.NumEpochs = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 6: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VestNowFactor", wireType) } - var stringLen uint64 + m.VestNowFactor = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3610,29 +3588,16 @@ func (m *MsgUpdateVestingInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.VestNowFactor |= int64(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.VestNowFactor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 7: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NumMaxVestings", wireType) } - var stringLen uint64 + m.NumMaxVestings = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3642,24 +3607,11 @@ func (m *MsgUpdateVestingInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NumMaxVestings |= int64(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.NumMaxVestings = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])