From 5ff7189160e078171b3b04d8ba3fe3b1fc0c9bc1 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Wed, 12 Apr 2023 15:00:01 +0200 Subject: [PATCH] remove legacy querier LCD/REST https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/UPGRADING.md#appmodule-interface https://github.com/cosmos/cosmos-sdk/pull/9594 https://github.com/cosmos/cosmos-sdk/pull/11797 --- app/consumer-democracy/app.go | 6 +----- app/consumer/app.go | 6 +----- app/provider/app.go | 6 +----- x/ccv/consumer/module.go | 5 ----- x/ccv/provider/module.go | 5 ----- 5 files changed, 3 insertions(+), 25 deletions(-) diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 420490cf5d..120ab9966d 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server/api" @@ -573,7 +572,6 @@ func New( ) app.MM.RegisterInvariants(&app.CrisisKeeper) - app.MM.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.MM.RegisterServices(app.configurator) @@ -871,14 +869,12 @@ func (app *App) GetTxConfig() client.TxConfig { // API server. func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // 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/app/consumer/app.go b/app/consumer/app.go index 6979caa023..8b82f900fe 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -17,7 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server/api" @@ -459,7 +458,6 @@ func New( ) app.MM.RegisterInvariants(&app.CrisisKeeper) - app.MM.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.MM.RegisterServices(app.configurator) @@ -702,14 +700,12 @@ func (app *App) GetTxConfig() client.TxConfig { // API server. func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // 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/app/provider/app.go b/app/provider/app.go index a8cc569348..e50dec23ba 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -14,7 +14,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/server/api" @@ -563,7 +562,6 @@ func New( ) app.MM.RegisterInvariants(&app.CrisisKeeper) - app.MM.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.MM.RegisterServices(app.configurator) @@ -809,14 +807,12 @@ func (app *App) GetTxConfig() client.TxConfig { // API server. func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // 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/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index ff22d2378d..c34d3f10e3 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -6,7 +6,6 @@ import ( "fmt" abci "github.com/cometbft/cometbft/abci/types" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -64,10 +63,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return data.Validate() } -// RegisterRESTRoutes implements AppModuleBasic interface -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the ibc-consumer module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { err := consumertypes.RegisterQueryHandlerClient(context.Background(), mux, consumertypes.NewQueryClient(clientCtx)) diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 1e55d99fce..8c390b8460 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -16,7 +16,6 @@ import ( "github.com/cosmos/interchain-security/x/ccv/provider/client/cli" "github.com/cosmos/interchain-security/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" ) @@ -61,10 +60,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return data.Validate() } -// RegisterRESTRoutes implements AppModuleBasic interface -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the ibc-provider module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { err := providertypes.RegisterQueryHandlerClient(context.Background(), mux, providertypes.NewQueryClient(clientCtx))