From 6792efea51f570f353c5f5515ac22e467d20217c Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Sat, 12 Nov 2022 04:42:11 +0000 Subject: [PATCH] refactor: remove unused MsgEmpty (#776) * Remove MsgEmpty from proto * Remove related logic * Update CHANGELOG.md --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 57 ---- proto/cosmos/auth/v1beta1/tx.proto | 23 -- x/auth/client/cli/tx.go | 54 ---- x/auth/keeper/msg_server.go | 31 -- x/auth/module.go | 3 +- x/auth/types/codec.go | 7 - x/auth/types/events.go | 7 - x/auth/types/keys.go | 3 - x/auth/types/msgs.go | 45 --- x/auth/types/msgs_test.go | 55 ---- x/auth/types/tx.pb.go | 461 +---------------------------- 12 files changed, 13 insertions(+), 734 deletions(-) delete mode 100644 proto/cosmos/auth/v1beta1/tx.proto delete mode 100644 x/auth/client/cli/tx.go delete mode 100644 x/auth/keeper/msg_server.go delete mode 100644 x/auth/types/events.go delete mode 100644 x/auth/types/msgs.go delete mode 100644 x/auth/types/msgs_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d4f508efa..06b33ccaea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features ### Improvements +* (x/auth) [\#776](https://github.com/line/lbm-sdk/pull/776) remove unused MsgEmpty ### Bug Fixes * (x/foundation) [\#772](https://github.com/line/lbm-sdk/pull/772) export x/foundation pool diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index b9cb6704d6..e3c5152c9b 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -26,12 +26,6 @@ - [Query](#cosmos.auth.v1beta1.Query) -- [cosmos/auth/v1beta1/tx.proto](#cosmos/auth/v1beta1/tx.proto) - - [MsgEmpty](#cosmos.auth.v1beta1.MsgEmpty) - - [MsgEmptyResponse](#cosmos.auth.v1beta1.MsgEmptyResponse) - - - [Msg](#cosmos.auth.v1beta1.Msg) - - [cosmos/authz/v1beta1/authz.proto](#cosmos/authz/v1beta1/authz.proto) - [GenericAuthorization](#cosmos.authz.v1beta1.GenericAuthorization) - [Grant](#cosmos.authz.v1beta1.Grant) @@ -1598,57 +1592,6 @@ Since: cosmos-sdk 0.43 | GET|/cosmos/auth/v1beta1/accounts| - -

Top

- -## cosmos/auth/v1beta1/tx.proto - - - - - -### MsgEmpty -MsgEmpty represents a message that doesn't do anything. Used to measure performance. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `from_address` | [string](#string) | | | - - - - - - - - -### MsgEmptyResponse -MsgEmptyResponse defines the Msg/Empty response type. - - - - - - - - - - - - - - -### Msg -Msg defines the auth Msg service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Empty` | [MsgEmpty](#cosmos.auth.v1beta1.MsgEmpty) | [MsgEmptyResponse](#cosmos.auth.v1beta1.MsgEmptyResponse) | Empty defines a method that doesn't do anything. Used to measure performance. | | - - - - -

Top

diff --git a/proto/cosmos/auth/v1beta1/tx.proto b/proto/cosmos/auth/v1beta1/tx.proto deleted file mode 100644 index c69ea31434..0000000000 --- a/proto/cosmos/auth/v1beta1/tx.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package cosmos.auth.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/line/lbm-sdk/x/auth/types"; - -// Msg defines the auth Msg service. -service Msg { - // Empty defines a method that doesn't do anything. Used to measure performance. - rpc Empty(MsgEmpty) returns (MsgEmptyResponse); -} - -// MsgEmpty represents a message that doesn't do anything. Used to measure performance. -message MsgEmpty { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; -} - -// MsgEmptyResponse defines the Msg/Empty response type. -message MsgEmptyResponse {} diff --git a/x/auth/client/cli/tx.go b/x/auth/client/cli/tx.go deleted file mode 100644 index 65f9b1ba1b..0000000000 --- a/x/auth/client/cli/tx.go +++ /dev/null @@ -1,54 +0,0 @@ -package cli - -import ( - "github.com/spf13/cobra" - - "github.com/line/lbm-sdk/client" - "github.com/line/lbm-sdk/client/flags" - "github.com/line/lbm-sdk/client/tx" - "github.com/line/lbm-sdk/x/auth/types" -) - -// NewTxCmd returns a root CLI command handler for all x/auth transaction commands. -func NewTxCmd() *cobra.Command { - txCmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Auth transaction subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - txCmd.AddCommand(NewEmptyTxCmd()) - - return txCmd -} - -// NewEmptyTxCmd returns a CLI command handler for creating a MsgEmpty transaction. -func NewEmptyTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "empty [from_key_or_address]", - Short: `Empty doesn't do anything. Used to measure performance.`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - err := cmd.Flags().Set(flags.FlagFrom, args[0]) - if err != nil { - return err - } - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgEmpty(clientCtx.GetFromAddress()) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/auth/keeper/msg_server.go b/x/auth/keeper/msg_server.go deleted file mode 100644 index bb499adfca..0000000000 --- a/x/auth/keeper/msg_server.go +++ /dev/null @@ -1,31 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/line/lbm-sdk/types" - "github.com/line/lbm-sdk/x/auth/types" -) - -type msgServer struct { - AccountKeeper -} - -// NewMsgServerImpl returns an implementation of the auth MsgServer interface for the provided Keeper. -func NewMsgServerImpl(keeper AccountKeeper) types.MsgServer { - return &msgServer{AccountKeeper: keeper} -} - -var _ types.MsgServer = msgServer{} - -func (k msgServer) Empty(goCtx context.Context, msg *types.MsgEmpty) (*types.MsgEmptyResponse, error) { - sdk.UnwrapSDKContext(goCtx).EventManager().EmitEvent( - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeySender, msg.FromAddress), - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeyAction, types.EventEmpty), - ), - ) - return &types.MsgEmptyResponse{}, nil -} diff --git a/x/auth/module.go b/x/auth/module.go index e826e0f2d6..ed5082f3c1 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -74,7 +74,7 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r // GetTxCmd returns the root tx command for the auth module. func (AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.NewTxCmd() + return nil } // GetQueryCmd returns the root query command for the auth module. @@ -128,7 +128,6 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.accountKeeper)) types.RegisterQueryServer(cfg.QueryServer(), am.accountKeeper) // m := keeper.NewMigrator(am.accountKeeper) diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index 9d0ac1baef..540e86c054 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -5,7 +5,6 @@ import ( "github.com/line/lbm-sdk/codec/types" cryptocodec "github.com/line/lbm-sdk/crypto/codec" sdk "github.com/line/lbm-sdk/types" - "github.com/line/lbm-sdk/types/msgservice" "github.com/line/lbm-sdk/x/auth/legacy/legacytx" authzcodec "github.com/line/lbm-sdk/x/authz/codec" govcodec "github.com/line/lbm-sdk/x/gov/codec" @@ -19,7 +18,6 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*AccountI)(nil), nil) cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil) cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount", nil) - cdc.RegisterConcrete(&MsgEmpty{}, "cosmos-sdk/MsgEmpty", nil) legacytx.RegisterLegacyAminoCodec(cdc) } @@ -27,11 +25,6 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces associates protoName with AccountI interface // and creates a registry of it's concrete implementations func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgEmpty{}, - ) - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) - registry.RegisterInterface( "cosmos.auth.v1beta1.AccountI", (*AccountI)(nil), diff --git a/x/auth/types/events.go b/x/auth/types/events.go deleted file mode 100644 index 1b28854da5..0000000000 --- a/x/auth/types/events.go +++ /dev/null @@ -1,7 +0,0 @@ -package types - -var ( - EventEmpty = "empty" - - AttributeValueCategory = ModuleName -) diff --git a/x/auth/types/keys.go b/x/auth/types/keys.go index e76505ae80..75bf6fdb55 100644 --- a/x/auth/types/keys.go +++ b/x/auth/types/keys.go @@ -11,9 +11,6 @@ const ( // StoreKey is string representation of the store key for auth StoreKey = "acc" - // RouterKey defines the module's message routing key - RouterKey = ModuleName - // FeeCollectorName the root string for the fee collector account address FeeCollectorName = "fee_collector" diff --git a/x/auth/types/msgs.go b/x/auth/types/msgs.go deleted file mode 100644 index 771650e40c..0000000000 --- a/x/auth/types/msgs.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdk "github.com/line/lbm-sdk/types" - sdkerrors "github.com/line/lbm-sdk/types/errors" -) - -// auth message types -const ( - TypeMsgEmpty = "empty" -) - -var _ sdk.Msg = &MsgEmpty{} - -// NewMsgEmpty creates a new MsgEmpty object -//nolint:interfacer -func NewMsgEmpty(fromAddr sdk.AccAddress) *MsgEmpty { - return &MsgEmpty{FromAddress: fromAddr.String()} -} - -func (msg MsgEmpty) Route() string { return ModuleName } - -func (msg MsgEmpty) Type() string { return TypeMsgEmpty } - -func (msg MsgEmpty) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - return nil -} - -// GetSignBytes Implements Msg. -func (msg MsgEmpty) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners Implements Msg. -func (msg MsgEmpty) GetSigners() []sdk.AccAddress { - addr, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{addr} -} diff --git a/x/auth/types/msgs_test.go b/x/auth/types/msgs_test.go deleted file mode 100644 index 04e4b693e7..0000000000 --- a/x/auth/types/msgs_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package types - -import ( - "encoding/hex" - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/line/lbm-sdk/types" -) - -func TestMsgSendRoute(t *testing.T) { - msg := NewMsgEmpty(sdk.AccAddress("from")) - - require.Equal(t, RouterKey, msg.Route()) - require.Equal(t, "empty", msg.Type()) -} - -func TestMsgSendValidation(t *testing.T) { - addr1 := sdk.AccAddress([]byte("from________________")) - addrEmpty := sdk.AccAddress("") - addrLong := sdk.AccAddress([]byte("Accidentally used 33 bytes pubkey")) - - cases := []struct { - expectedErr string // empty means no error expected - msg *MsgEmpty - }{ - {"", NewMsgEmpty(addr1)}, // valid - {"Invalid sender address (empty address string is not allowed): invalid address", NewMsgEmpty(addrEmpty)}, - {"", NewMsgEmpty(addrLong)}, - } - - for _, tc := range cases { - err := tc.msg.ValidateBasic() - if tc.expectedErr == "" { - require.Nil(t, err) - } else { - require.EqualError(t, err, tc.expectedErr) - } - } -} - -func TestMsgSendGetSignBytes(t *testing.T) { - res := NewMsgEmpty(sdk.AccAddress([]byte("input"))).GetSignBytes() - - expected := `{"type":"cosmos-sdk/MsgEmpty","value":{"from_address":"link1d9h8qat5fnwd3e"}}` - require.Equal(t, expected, string(res)) -} - -func TestMsgSendGetSigners(t *testing.T) { - res := NewMsgEmpty(sdk.AccAddress([]byte("input111111111111111"))).GetSigners() - bytes, _ := sdk.AccAddressFromBech32(res[0].String()) - require.Equal(t, "696e707574313131313131313131313131313131", fmt.Sprintf("%v", hex.EncodeToString(bytes))) -} diff --git a/x/auth/types/tx.pb.go b/x/auth/types/tx.pb.go index fafd5dc0aa..4c74d94753 100644 --- a/x/auth/types/tx.pb.go +++ b/x/auth/types/tx.pb.go @@ -10,11 +10,7 @@ import ( 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" ) // Reference imports to suppress errors if they are not otherwise used. @@ -28,106 +24,20 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgEmpty represents a message that doesn't do anything. Used to measure performance. -type MsgEmpty struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` -} - -func (m *MsgEmpty) Reset() { *m = MsgEmpty{} } -func (m *MsgEmpty) String() string { return proto.CompactTextString(m) } -func (*MsgEmpty) ProtoMessage() {} -func (*MsgEmpty) Descriptor() ([]byte, []int) { - return fileDescriptor_c2d62bd9c4c212e5, []int{0} -} -func (m *MsgEmpty) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEmpty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEmpty.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 *MsgEmpty) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEmpty.Merge(m, src) -} -func (m *MsgEmpty) XXX_Size() int { - return m.Size() -} -func (m *MsgEmpty) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEmpty.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEmpty proto.InternalMessageInfo - -// MsgEmptyResponse defines the Msg/Empty response type. -type MsgEmptyResponse struct { -} - -func (m *MsgEmptyResponse) Reset() { *m = MsgEmptyResponse{} } -func (m *MsgEmptyResponse) String() string { return proto.CompactTextString(m) } -func (*MsgEmptyResponse) ProtoMessage() {} -func (*MsgEmptyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c2d62bd9c4c212e5, []int{1} -} -func (m *MsgEmptyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEmptyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEmptyResponse.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 *MsgEmptyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEmptyResponse.Merge(m, src) -} -func (m *MsgEmptyResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgEmptyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEmptyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEmptyResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgEmpty)(nil), "cosmos.auth.v1beta1.MsgEmpty") - proto.RegisterType((*MsgEmptyResponse)(nil), "cosmos.auth.v1beta1.MsgEmptyResponse") -} - func init() { proto.RegisterFile("cosmos/auth/v1beta1/tx.proto", fileDescriptor_c2d62bd9c4c212e5) } var fileDescriptor_c2d62bd9c4c212e5 = []byte{ - // 251 bytes of a gzipped FileDescriptorProto + // 150 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x2c, 0x2d, 0xc9, 0xd0, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xea, 0x81, 0x64, 0xf5, - 0xa0, 0xb2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, 0x54, 0x29, - 0x80, 0x8b, 0xc3, 0xb7, 0x38, 0xdd, 0x35, 0xb7, 0xa0, 0xa4, 0x52, 0xc8, 0x8a, 0x8b, 0x27, 0xad, - 0x28, 0x3f, 0x37, 0x3e, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, - 0xd3, 0x49, 0xfc, 0xd3, 0x3d, 0x79, 0xe1, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0x64, 0x59, 0xa5, - 0x20, 0x6e, 0x10, 0xd7, 0x11, 0xc2, 0xb3, 0xe2, 0xe8, 0x58, 0x20, 0xcf, 0xf0, 0x62, 0x81, 0x3c, - 0x83, 0x92, 0x10, 0x97, 0x00, 0xcc, 0xc4, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, - 0x10, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0x21, 0x5f, 0x2e, 0x56, 0x88, 0x4d, 0xb2, 0x7a, 0x58, 0x5c, - 0xa8, 0x07, 0xd3, 0x26, 0xa5, 0x8a, 0x57, 0x1a, 0x66, 0xaa, 0x93, 0xdd, 0x89, 0x47, 0x72, 0x8c, - 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, - 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, - 0xe7, 0xea, 0xe7, 0x64, 0xe6, 0xa5, 0xea, 0xe7, 0x24, 0xe5, 0xea, 0x16, 0xa7, 0x64, 0xeb, 0x57, - 0x40, 0x42, 0xac, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x04, 0xc6, 0x80, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x07, 0xe4, 0xb6, 0x2b, 0x4d, 0x01, 0x00, 0x00, + 0xa0, 0xb2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, 0xd4, 0x88, + 0x95, 0x8b, 0xd9, 0xb7, 0x38, 0xdd, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, + 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, + 0x18, 0xa2, 0x54, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x73, 0x32, + 0xf3, 0x52, 0xf5, 0x73, 0x92, 0x72, 0x75, 0x8b, 0x53, 0xb2, 0xf5, 0x2b, 0x20, 0x96, 0x97, 0x54, + 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x4d, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x91, 0xd4, + 0xe3, 0x05, 0x98, 0x00, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -142,8 +52,6 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 { - // Empty defines a method that doesn't do anything. Used to measure performance. - Empty(ctx context.Context, in *MsgEmpty, opts ...grpc.CallOption) (*MsgEmptyResponse, error) } type msgClient struct { @@ -154,369 +62,22 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) Empty(ctx context.Context, in *MsgEmpty, opts ...grpc.CallOption) (*MsgEmptyResponse, error) { - out := new(MsgEmptyResponse) - err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Msg/Empty", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServer is the server API for Msg service. type MsgServer interface { - // Empty defines a method that doesn't do anything. Used to measure performance. - Empty(context.Context, *MsgEmpty) (*MsgEmptyResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) Empty(ctx context.Context, req *MsgEmpty) (*MsgEmptyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Empty not implemented") -} - func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_Empty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgEmpty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Empty(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.auth.v1beta1.Msg/Empty", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Empty(ctx, req.(*MsgEmpty)) - } - return interceptor(ctx, in, info, handler) -} - var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.auth.v1beta1.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Empty", - Handler: _Msg_Empty_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/auth/v1beta1/tx.proto", + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/auth/v1beta1/tx.proto", } - -func (m *MsgEmpty) 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 *MsgEmpty) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEmpty) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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 *MsgEmptyResponse) 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 *MsgEmptyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEmptyResponse) 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 - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgEmpty) 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)) - } - return n -} - -func (m *MsgEmptyResponse) 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 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgEmpty) 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: MsgEmpty: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEmpty: 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 - 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 *MsgEmptyResponse) 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: MsgEmptyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEmptyResponse: 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 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -)