From 65b4f13d9c2c17f5e4160c6c42bee0a62d0b2ead Mon Sep 17 00:00:00 2001 From: Facundo Medica Date: Wed, 27 Apr 2022 09:46:56 -0300 Subject: [PATCH 1/2] remove all RegisterRESTRoutes --- docs/building-modules/module-manager.md | 2 -- simapp/app.go | 3 +- tests/mocks/types_module_module.go | 37 ------------------------- types/module/module.go | 9 ------ types/module/module_test.go | 6 +--- x/auth/module.go | 6 ---- x/auth/vesting/module.go | 5 ---- x/authz/module/module.go | 5 ---- x/bank/module.go | 6 ---- x/capability/module.go | 5 ---- x/crisis/module.go | 5 ---- x/distribution/module.go | 6 ---- x/evidence/module.go | 6 ---- x/feegrant/module/module.go | 5 ---- x/genutil/module.go | 5 ---- x/gov/module.go | 6 ---- x/group/module/module.go | 5 ---- x/mint/module.go | 6 ---- x/nft/module/module.go | 5 ---- x/params/module.go | 5 ---- x/slashing/module.go | 6 ---- x/staking/module.go | 6 ---- x/upgrade/module.go | 6 ---- 23 files changed, 2 insertions(+), 154 deletions(-) diff --git a/docs/building-modules/module-manager.md b/docs/building-modules/module-manager.md index e2a5588b3129..b3e4094e711a 100644 --- a/docs/building-modules/module-manager.md +++ b/docs/building-modules/module-manager.md @@ -38,7 +38,6 @@ Let us go through the methods: * `RegisterInterfaces(codectypes.InterfaceRegistry)`: Registers a module's interface types and their concrete implementations as `proto.Message`. * `DefaultGenesis(codec.JSONCodec)`: Returns a default [`GenesisState`](./genesis.md#genesisstate) for the module, marshalled to `json.RawMessage`. The default `GenesisState` need to be defined by the module developer and is primarily used for testing. * `ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage)`: Used to validate the `GenesisState` defined by a module, given in its `json.RawMessage` form. It will usually unmarshall the `json` before running a custom [`ValidateGenesis`](./genesis.md#validategenesis) function defined by the module developer. -* `RegisterRESTRoutes(client.Context, *mux.Router)`: Registers the REST routes for the module. These routes will be used to map REST request to the module in order to process them. See [gRPC and REST](../core/grpc_rest.md) for more. * `RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux)`: Registers gRPC routes for the module. * `GetTxCmd()`: Returns the root [`Tx` command](./module-interfaces.md#tx) for the module. The subcommands of this root command are used by end-users to generate new transactions containing [`message`s](./messages-and-queries.md#queries) defined in the module. * `GetQueryCmd()`: Return the root [`query` command](./module-interfaces.md#query) for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module. @@ -115,7 +114,6 @@ It implements the following methods: * `RegisterInterfaces(registry codectypes.InterfaceRegistry)`: Registers interface types and implementations of each of the application's `AppModuleBasic`. * `DefaultGenesis(cdc codec.JSONCodec)`: Provides default genesis information for modules in the application by calling the [`DefaultGenesis(cdc codec.JSONCodec)`](./genesis.md#defaultgenesis) function of each module. It is used to construct a default genesis file for the application. * `ValidateGenesis(cdc codec.JSONCodec, txEncCfg client.TxEncodingConfig, genesis map[string]json.RawMessage)`: Validates the genesis information modules by calling the [`ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage)`](./genesis.md#validategenesis) function of each module. -* `RegisterRESTRoutes(ctx client.Context, rtr *mux.Router)`: Registers REST routes for modules by calling the [`RegisterRESTRoutes`](./module-interfaces.md#register-routes) function of each module. This function is usually called function from the `main.go` function of the [application's command-line interface](../core/cli.md). * `RegisterGRPCGatewayRoutes(clientCtx client.Context, rtr *runtime.ServeMux)`: Registers gRPC routes for modules. * `AddTxCommands(rootTxCmd *cobra.Command)`: Adds modules' transaction commands to the application's [`rootTxCommand`](../core/cli.md#transaction-commands). This function is usually called function from the `main.go` function of the [application's command-line interface](../core/cli.md). * `AddQueryCommands(rootQueryCmd *cobra.Command)`: Adds modules' query commands to the application's [`rootQueryCommand`](../core/cli.md#query-commands). This function is usually called function from the `main.go` function of the [application's command-line interface](../core/cli.md). diff --git a/simapp/app.go b/simapp/app.go index b592b1eb3cf6..3d5ea67e5c0d 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -580,8 +580,7 @@ func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICon // Register new tendermint queries routes from grpc-gateway. tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register legacy and grpc-gateway routes for all modules. - ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) + // Register grpc-gateway routes for all modules. ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily diff --git a/tests/mocks/types_module_module.go b/tests/mocks/types_module_module.go index 772dc5de6ebe..5a07c7563d61 100644 --- a/tests/mocks/types_module_module.go +++ b/tests/mocks/types_module_module.go @@ -14,7 +14,6 @@ import ( types0 "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" gomock "github.com/golang/mock/gomock" - mux "github.com/gorilla/mux" runtime "github.com/grpc-ecosystem/grpc-gateway/runtime" cobra "github.com/spf13/cobra" types1 "github.com/tendermint/tendermint/abci/types" @@ -135,18 +134,6 @@ func (mr *MockAppModuleBasicMockRecorder) RegisterLegacyAminoCodec(arg0 interfac return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterLegacyAminoCodec), arg0) } -// RegisterRESTRoutes mocks base method. -func (m *MockAppModuleBasic) RegisterRESTRoutes(arg0 client.Context, arg1 *mux.Router) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterRESTRoutes", arg0, arg1) -} - -// RegisterRESTRoutes indicates an expected call of RegisterRESTRoutes. -func (mr *MockAppModuleBasicMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRESTRoutes", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterRESTRoutes), arg0, arg1) -} - // ValidateGenesis mocks base method. func (m *MockAppModuleBasic) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { m.ctrl.T.Helper() @@ -304,18 +291,6 @@ func (mr *MockAppModuleGenesisMockRecorder) RegisterLegacyAminoCodec(arg0 interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModuleGenesis)(nil).RegisterLegacyAminoCodec), arg0) } -// RegisterRESTRoutes mocks base method. -func (m *MockAppModuleGenesis) RegisterRESTRoutes(arg0 client.Context, arg1 *mux.Router) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterRESTRoutes", arg0, arg1) -} - -// RegisterRESTRoutes indicates an expected call of RegisterRESTRoutes. -func (mr *MockAppModuleGenesisMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRESTRoutes", reflect.TypeOf((*MockAppModuleGenesis)(nil).RegisterRESTRoutes), arg0, arg1) -} - // ValidateGenesis mocks base method. func (m *MockAppModuleGenesis) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error { m.ctrl.T.Helper() @@ -553,18 +528,6 @@ func (mr *MockAppModuleMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModule)(nil).RegisterLegacyAminoCodec), arg0) } -// RegisterRESTRoutes mocks base method. -func (m *MockAppModule) RegisterRESTRoutes(arg0 client.Context, arg1 *mux.Router) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterRESTRoutes", arg0, arg1) -} - -// RegisterRESTRoutes indicates an expected call of RegisterRESTRoutes. -func (mr *MockAppModuleMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRESTRoutes", reflect.TypeOf((*MockAppModule)(nil).RegisterRESTRoutes), arg0, arg1) -} - // RegisterServices mocks base method. func (m *MockAppModule) RegisterServices(arg0 module.Configurator) { m.ctrl.T.Helper() diff --git a/types/module/module.go b/types/module/module.go index e38e6bc78fc0..60c524a39f09 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -33,7 +33,6 @@ import ( "fmt" "sort" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -55,7 +54,6 @@ type AppModuleBasic interface { ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error // client functionality - RegisterRESTRoutes(client.Context, *mux.Router) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) GetTxCmd() *cobra.Command GetQueryCmd() *cobra.Command @@ -108,13 +106,6 @@ func (bm BasicManager) ValidateGenesis(cdc codec.JSONCodec, txEncCfg client.TxEn return nil } -// RegisterRESTRoutes registers all module rest routes -func (bm BasicManager) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - for _, b := range bm { - b.RegisterRESTRoutes(clientCtx, rtr) - } -} - // RegisterGRPCGatewayRoutes registers all module rest routes func (bm BasicManager) RegisterGRPCGatewayRoutes(clientCtx client.Context, rtr *runtime.ServeMux) { for _, b := range bm { diff --git a/types/module/module_test.go b/types/module/module_test.go index 4dbb4a73c5b6..4bbae7f4bc26 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -5,7 +5,6 @@ import ( "errors" "testing" - "github.com/gorilla/mux" "github.com/golang/mock/gomock" "github.com/spf13/cobra" "github.com/stretchr/testify/require" @@ -13,9 +12,9 @@ import ( "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/tests/mocks" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -41,7 +40,6 @@ func TestBasicManager(t *testing.T) { mockAppModuleBasic1.EXPECT().ValidateGenesis(gomock.Eq(cdc), gomock.Eq(nil), gomock.Eq(wantDefaultGenesis["mockAppModuleBasic1"])).Times(1).Return(errFoo) mockAppModuleBasic1.EXPECT().RegisterLegacyAminoCodec(gomock.Eq(legacyAmino)).Times(1) mockAppModuleBasic1.EXPECT().RegisterInterfaces(gomock.Eq(interfaceRegistry)).Times(1) - mockAppModuleBasic1.EXPECT().RegisterRESTRoutes(gomock.Eq(client.Context{}), gomock.Eq(&mux.Router{})).Times(1) mockAppModuleBasic1.EXPECT().GetTxCmd().Times(1).Return(nil) mockAppModuleBasic1.EXPECT().GetQueryCmd().Times(1).Return(nil) @@ -58,8 +56,6 @@ func TestBasicManager(t *testing.T) { require.True(t, errors.Is(errFoo, mm.ValidateGenesis(cdc, nil, wantDefaultGenesis))) - mm.RegisterRESTRoutes(client.Context{}, &mux.Router{}) - mockCmd := &cobra.Command{Use: "root"} mm.AddTxCommands(mockCmd) diff --git a/x/auth/module.go b/x/auth/module.go index dfb125058bd9..58f567fa26cf 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -59,11 +58,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return types.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the auth module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/auth` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the auth module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/auth/vesting/module.go b/x/auth/vesting/module.go index 272ebf2656bf..49925dd61f2c 100644 --- a/x/auth/vesting/module.go +++ b/x/auth/vesting/module.go @@ -3,7 +3,6 @@ package vesting import ( "encoding/json" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -54,10 +53,6 @@ func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConf return nil } -// RegisterRESTRoutes registers the REST routes for the vesting module. Currently, this is a no-op. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the module's gRPC Gateway routes. Currently, this // is a no-op. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {} diff --git a/x/authz/module/module.go b/x/authz/module/module.go index 219969f34f36..7ff061c691f5 100644 --- a/x/authz/module/module.go +++ b/x/authz/module/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -77,10 +76,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEn return authz.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the authz module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(_ sdkclient.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the authz module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { if err := authz.RegisterQueryHandlerClient(context.Background(), mux, authz.NewQueryClient(clientCtx)); err != nil { diff --git a/x/bank/module.go b/x/bank/module.go index bd809816a7a3..bfeee7eed6ba 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -7,7 +7,6 @@ import ( "math/rand" "time" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -61,11 +60,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo return data.Validate() } -// RegisterRESTRoutes registers the REST routes for the bank module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/bank` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the bank module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/capability/module.go b/x/capability/module.go index f8295948d9b7..e2ac1709795c 100644 --- a/x/capability/module.go +++ b/x/capability/module.go @@ -6,7 +6,6 @@ import ( "math/rand" "time" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -68,10 +67,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return genState.Validate() } -// RegisterRESTRoutes registers the REST routes for the capability module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the capability module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { } diff --git a/x/crisis/module.go b/x/crisis/module.go index 428e8adc1a05..7c058a4f22e0 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -5,7 +5,6 @@ import ( "fmt" "time" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -60,10 +59,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return types.ValidateGenesis(&data) } -// RegisterRESTRoutes registers REST routes for the crisis module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the capability module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {} diff --git a/x/distribution/module.go b/x/distribution/module.go index 13cf674e3be0..e2f240b1edaf 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -61,11 +60,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEn return types.ValidateGenesis(&data) } -// RegisterRESTRoutes registers the REST routes for the distribution module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/distribution` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(_ sdkclient.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the distribution module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/evidence/module.go b/x/evidence/module.go index 2d65ef8ead8a..0dcf1ac3fac3 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -71,11 +70,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return gs.Validate() } -// RegisterRESTRoutes registers the evidence module's REST service handlers. -// Deprecated: RegisterRESTRoutes is deprecated. `x/evidence` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the evidence module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/feegrant/module/module.go b/x/feegrant/module/module.go index 2246de692456..6752b16f2331 100644 --- a/x/feegrant/module/module.go +++ b/x/feegrant/module/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -86,10 +85,6 @@ func (a AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.Tx return feegrant.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the feegrant module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx sdkclient.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the feegrant module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { if err := feegrant.RegisterQueryHandlerClient(context.Background(), mux, feegrant.NewQueryClient(clientCtx)); err != nil { diff --git a/x/genutil/module.go b/x/genutil/module.go index db3071ca00c7..9b91849b68c0 100644 --- a/x/genutil/module.go +++ b/x/genutil/module.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -53,10 +52,6 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, txEncodingConfig cl return types.ValidateGenesis(&data, txEncodingConfig.TxJSONDecoder()) } -// RegisterRESTRoutes registers the REST routes for the genutil module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the genutil module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { } diff --git a/x/gov/module.go b/x/gov/module.go index 875c00437752..b93dab8f1f0a 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -8,7 +8,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -74,11 +73,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return v1.ValidateGenesis(&data) } -// RegisterRESTRoutes registers the REST routes for the gov module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/gov` legacy REST implementation -// has been removed from the SDK. -func (a AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the gov module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := v1.RegisterQueryHandlerClient(context.Background(), mux, v1.NewQueryClient(clientCtx)); err != nil { diff --git a/x/group/module/module.go b/x/group/module/module.go index 086728422ed4..7b8baf8538bf 100644 --- a/x/group/module/module.go +++ b/x/group/module/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -97,10 +96,6 @@ func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { // RegisterLegacyAminoCodec registers the group module's types for the given codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} -// RegisterRESTRoutes registers the REST routes for the group module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(_ sdkclient.Context, _ *mux.Router) {} - // Name returns the group module's name. func (AppModule) Name() string { return group.ModuleName diff --git a/x/mint/module.go b/x/mint/module.go index be5ba7fdf2f9..fc32ff67ff05 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -63,11 +62,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return types.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the mint module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/mint` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the mint module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/nft/module/module.go b/x/nft/module/module.go index 0b456e55c33c..ab6fc9633cc9 100644 --- a/x/nft/module/module.go +++ b/x/nft/module/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -71,10 +70,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEn return nft.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the nft module. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx sdkclient.Context, r *mux.Router) { -} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the nft module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { if err := nft.RegisterQueryHandlerClient(context.Background(), mux, nft.NewQueryClient(clientCtx)); err != nil { diff --git a/x/params/module.go b/x/params/module.go index f17ab2199d44..da4679f8789f 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -51,10 +50,6 @@ func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, config client.TxEncodin return nil } -// RegisterRESTRoutes registers the REST routes for the params module. -// Deprecated: RegisterRESTRoutes is deprecated. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the params module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := proposal.RegisterQueryHandlerClient(context.Background(), mux, proposal.NewQueryClient(clientCtx)); err != nil { diff --git a/x/slashing/module.go b/x/slashing/module.go index cf51b57066ad..7627bbf3a0b9 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -68,11 +67,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return types.ValidateGenesis(data) } -// RegisterRESTRoutes registers the REST routes for the slashing module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/slashing` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the slashig module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/staking/module.go b/x/staking/module.go index 39665347c994..92aab0885d44 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -6,7 +6,6 @@ import ( "fmt" "math/rand" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -71,11 +70,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return ValidateGenesis(&data) } -// RegisterRESTRoutes registers the REST routes for the staking module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/staking` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 045d23370586..526e7c791cdc 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -41,11 +40,6 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } -// RegisterRESTRoutes registers the REST routes for the upgrade module. -// Deprecated: RegisterRESTRoutes is deprecated. `x/upgrade` legacy REST implementation -// has been removed from the SDK. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the upgrade module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { From 71b5777a9d45462ea1b00879038bb1cc7dd2be42 Mon Sep 17 00:00:00 2001 From: Facundo Medica Date: Wed, 27 Apr 2022 09:49:06 -0300 Subject: [PATCH 2/2] changelog++ --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bfb1a5723e5..25192f6c2685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -161,6 +161,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Client Breaking Changes +* [\#11797](https://github.com/cosmos/cosmos-sdk/pull/11797) Remove all RegisterRESTRoutes (previously deprecated) * [\#11089](https://github.com/cosmos/cosmos-sdk/pull/11089]) interacting with the node through `grpc.Dial` requires clients to pass a codec refer to [doc](docs/run-node/interact-node.md). * [\#9594](https://github.com/cosmos/cosmos-sdk/pull/9594) Remove legacy REST API. Please see the [REST Endpoints Migration guide](https://docs.cosmos.network/master/migrations/rest.html) to migrate to the new REST endpoints. * [\#9995](https://github.com/cosmos/cosmos-sdk/pull/9995) Increased gas cost for creating proposals.