diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 0c5ce53ac8cf..41873315c05f 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -6,6 +6,15 @@ import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; + +// Msg defines the bank Msg service. +service Msg { + // CreateVestingAccount defines a method that enables creating a vesting + // account. + rpc CreateVestingAccount(MsgCreateVestingAccount) returns (MsgCreateVestingAccountResponse); +} + + // MsgCreateVestingAccount defines a message that enables creating a vesting // account. message MsgCreateVestingAccount { @@ -19,3 +28,6 @@ message MsgCreateVestingAccount { int64 end_time = 4 [(gogoproto.moretags) = "yaml:\"end_time\""]; bool delayed = 5; } + +// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. +message MsgCreateVestingAccountResponse { } \ No newline at end of file diff --git a/x/auth/vesting/handler.go b/x/auth/vesting/handler.go index eef8787bda22..1d32e9969bb5 100644 --- a/x/auth/vesting/handler.go +++ b/x/auth/vesting/handler.go @@ -1,95 +1,26 @@ package vesting import ( - "github.com/armon/go-metrics" - - "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) // NewHandler returns a handler for x/auth message types. func NewHandler(ak keeper.AccountKeeper, bk types.BankKeeper) sdk.Handler { + msgServer := NewMsgServerImpl(ak, bk) + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) switch msg := msg.(type) { case *types.MsgCreateVestingAccount: - return handleMsgCreateVestingAccount(ctx, ak, bk, msg) + res, err := msgServer.CreateVestingAccount(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } - -func handleMsgCreateVestingAccount(ctx sdk.Context, ak keeper.AccountKeeper, bk types.BankKeeper, msg *types.MsgCreateVestingAccount) (*sdk.Result, error) { - if err := bk.SendEnabledCoins(ctx, msg.Amount...); err != nil { - return nil, err - } - - from, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - return nil, err - } - to, err := sdk.AccAddressFromBech32(msg.ToAddress) - if err != nil { - return nil, err - } - - if bk.BlockedAddr(to) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) - } - - if acc := ak.GetAccount(ctx, to); acc != nil { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) - } - - baseAccount := ak.NewAccountWithAddress(ctx, to) - if _, ok := baseAccount.(*authtypes.BaseAccount); !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid account type; expected: BaseAccount, got: %T", baseAccount) - } - - baseVestingAccount := types.NewBaseVestingAccount(baseAccount.(*authtypes.BaseAccount), msg.Amount.Sort(), msg.EndTime) - - var acc authtypes.AccountI - - if msg.Delayed { - acc = types.NewDelayedVestingAccountRaw(baseVestingAccount) - } else { - acc = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) - } - - ak.SetAccount(ctx, acc) - - defer func() { - telemetry.IncrCounter(1, "new", "account") - - for _, a := range msg.Amount { - if a.Amount.IsInt64() { - telemetry.SetGaugeWithLabels( - []string{"tx", "msg", "create_vesting_account"}, - float32(a.Amount.Int64()), - []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, - ) - } - } - }() - - err = bk.SendCoins(ctx, from, to, msg.Amount) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - ) - - return &sdk.Result{Events: ctx.EventManager().ABCIEvents()}, nil -} diff --git a/x/auth/vesting/msg_server.go b/x/auth/vesting/msg_server.go new file mode 100644 index 000000000000..dadd65dbcf1c --- /dev/null +++ b/x/auth/vesting/msg_server.go @@ -0,0 +1,100 @@ +package vesting + +import ( + "context" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/armon/go-metrics" + + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" +) + +type msgServer struct { + keeper.AccountKeeper + types.BankKeeper +} + +// NewMsgServerImpl returns an implementation of the vesting MsgServer interface, +// wrapping the corresponding AccountKeeper and BankKeeper. +func NewMsgServerImpl(k keeper.AccountKeeper, bk types.BankKeeper) types.MsgServer { + return &msgServer{AccountKeeper: k, BankKeeper: bk} +} + +var _ types.MsgServer = msgServer{} + +func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCreateVestingAccount) (*types.MsgCreateVestingAccountResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + ak := s.AccountKeeper + bk := s.BankKeeper + + if err := bk.SendEnabledCoins(ctx, msg.Amount...); err != nil { + return nil, err + } + + from, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + return nil, err + } + to, err := sdk.AccAddressFromBech32(msg.ToAddress) + if err != nil { + return nil, err + } + + if bk.BlockedAddr(to) { + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) + } + + if acc := ak.GetAccount(ctx, to); acc != nil { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) + } + + baseAccount := ak.NewAccountWithAddress(ctx, to) + if _, ok := baseAccount.(*authtypes.BaseAccount); !ok { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid account type; expected: BaseAccount, got: %T", baseAccount) + } + + baseVestingAccount := types.NewBaseVestingAccount(baseAccount.(*authtypes.BaseAccount), msg.Amount.Sort(), msg.EndTime) + + var acc authtypes.AccountI + + if msg.Delayed { + acc = types.NewDelayedVestingAccountRaw(baseVestingAccount) + } else { + acc = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) + } + + ak.SetAccount(ctx, acc) + + defer func() { + telemetry.IncrCounter(1, "new", "account") + + for _, a := range msg.Amount { + if a.Amount.IsInt64() { + telemetry.SetGaugeWithLabels( + []string{"tx", "msg", "create_vesting_account"}, + float32(a.Amount.Int64()), + []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, + ) + } + } + }() + + err = bk.SendCoins(ctx, from, to, msg.Amount) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + ) + + return &types.MsgCreateVestingAccountResponse{}, nil +} diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go index b277f3518f70..ab3283c238aa 100644 --- a/x/auth/vesting/types/tx.pb.go +++ b/x/auth/vesting/types/tx.pb.go @@ -4,11 +4,16 @@ package types import ( + context "context" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" io "io" math "math" math_bits "math/bits" @@ -103,37 +108,78 @@ func (m *MsgCreateVestingAccount) GetDelayed() bool { return false } +// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. +type MsgCreateVestingAccountResponse struct { +} + +func (m *MsgCreateVestingAccountResponse) Reset() { *m = MsgCreateVestingAccountResponse{} } +func (m *MsgCreateVestingAccountResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateVestingAccountResponse) ProtoMessage() {} +func (*MsgCreateVestingAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{1} +} +func (m *MsgCreateVestingAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateVestingAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateVestingAccountResponse.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 *MsgCreateVestingAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateVestingAccountResponse.Merge(m, src) +} +func (m *MsgCreateVestingAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateVestingAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateVestingAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateVestingAccountResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccount") + proto.RegisterType((*MsgCreateVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") } func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } var fileDescriptor_5338ca97811f9792 = []byte{ - // 365 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0x3f, 0x4f, 0xf2, 0x40, - 0x1c, 0xee, 0x01, 0x2f, 0x7f, 0x8e, 0x37, 0x79, 0xf3, 0x16, 0x95, 0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6, 0x11, 0xc9, 0xde, 0x56, 0xaa, 0x7a, 0xd5, 0x6c, 0x5f, 0x9c, 0x5a, 0xc5, 0xd8, 0xac, - 0x7e, 0xb9, 0xd4, 0x1a, 0xd1, 0x28, 0x76, 0xce, 0xd7, 0xa9, 0x26, 0xbd, 0xbc, 0x6b, 0x66, 0x18, - 0xf1, 0xc9, 0xdc, 0xb3, 0x7c, 0x4a, 0xec, 0x62, 0xab, 0xf8, 0x9c, 0xb1, 0xe0, 0xd1, 0xe6, 0xab, - 0x19, 0x66, 0xb9, 0x81, 0xb9, 0x45, 0xb4, 0x6c, 0xc1, 0x26, 0x8e, 0x83, 0x31, 0x8f, 0x08, 0x56, - 0x6a, 0x3a, 0x30, 0xab, 0x4e, 0x67, 0x9f, 0x6a, 0xff, 0x44, 0xb1, 0x92, 0x31, 0xdc, 0x06, 0x8e, - 0x83, 0xdb, 0x88, 0x60, 0x59, 0x81, 0x8d, 0x00, 0x4f, 0xd1, 0x0a, 0x07, 0xca, 0x1f, 0x1d, 0x98, - 0x4d, 0xb7, 0x84, 0x83, 0xda, 0xe7, 0xb3, 0x06, 0x9c, 0xeb, 0xf5, 0x56, 0x05, 0x9b, 0xad, 0x0a, - 0x3e, 0xb6, 0x2a, 0x78, 0xda, 0xa9, 0xd2, 0x66, 0xa7, 0x4a, 0x6f, 0x3b, 0x55, 0xba, 0xef, 0xff, - 0xda, 0x6d, 0x69, 0xa3, 0x39, 0x9f, 0x1c, 0x0e, 0x9d, 0x57, 0xf5, 0xea, 0xf9, 0x59, 0x2e, 0xbf, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x22, 0x3f, 0x4e, 0xe2, 0x07, 0x02, 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, + 0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x70, 0x55, 0x2d, 0xd1, 0x8b, 0xdf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xe7, 0x28, 0xaf, 0xe5, 0xb5, 0x02, 0x00, 0x00, } func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { @@ -177,6 +223,91 @@ func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { } return true } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateVestingAccount defines a method that enables creating a vesting + // account. + CreateVestingAccount(ctx context.Context, in *MsgCreateVestingAccount, opts ...grpc.CallOption) (*MsgCreateVestingAccountResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateVestingAccount(ctx context.Context, in *MsgCreateVestingAccount, opts ...grpc.CallOption) (*MsgCreateVestingAccountResponse, error) { + out := new(MsgCreateVestingAccountResponse) + err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateVestingAccount defines a method that enables creating a vesting + // account. + CreateVestingAccount(context.Context, *MsgCreateVestingAccount) (*MsgCreateVestingAccountResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateVestingAccount(ctx context.Context, req *MsgCreateVestingAccount) (*MsgCreateVestingAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateVestingAccount not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateVestingAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateVestingAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateVestingAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateVestingAccount(ctx, req.(*MsgCreateVestingAccount)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.vesting.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateVestingAccount", + Handler: _Msg_CreateVestingAccount_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/vesting/v1beta1/tx.proto", +} + func (m *MsgCreateVestingAccount) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -243,6 +374,29 @@ func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgCreateVestingAccountResponse) 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 *MsgCreateVestingAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateVestingAccountResponse) 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 @@ -283,6 +437,15 @@ func (m *MsgCreateVestingAccount) Size() (n int) { return n } +func (m *MsgCreateVestingAccountResponse) 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 } @@ -479,6 +642,59 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCreateVestingAccountResponse) 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: MsgCreateVestingAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVestingAccountResponse: 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 { + return ErrInvalidLengthTx + } + if (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