Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup deprecated code #2060

Merged
merged 2 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions x/incentive/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ const (

// StoreKey defines the primary module store key
StoreKey = ModuleName

// StoreKey defines the query route
QuerierRoute = ModuleName

// RouterKey is the message route
RouterKey = ModuleName
)

type (
Expand Down
21 changes: 6 additions & 15 deletions x/incentive/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,6 @@ func (AppModule) ConsensusVersion() uint64 {
return 1
}

// Deprecated: Route returns the message routing key for the x/incentive module.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}

// QuerierRoute returns the x/incentive module's query routing key.
func (AppModule) QuerierRoute() string { return incentive.QuerierRoute }

// LegacyQuerierHandler returns a no-op legacy querier.
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return func(sdk.Context, []string, abci.RequestQuery) ([]byte, error) {
return nil, fmt.Errorf("legacy querier not supported for the x/%s module", incentive.ModuleName)
}
}

// RegisterServices registers gRPC services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
incentive.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
Expand Down Expand Up @@ -173,3 +158,9 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return EndBlocker(ctx, am.keeper)
}

// DEPRECATED

func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil }
func (AppModule) QuerierRoute() string { return "" }
func (AppModule) Route() sdk.Route { return sdk.Route{} }
28 changes: 14 additions & 14 deletions x/incentive/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
}

// Route implements the sdk.Msg interface.
func (msg MsgClaim) Route() string { return RouterKey }
func (msg MsgClaim) Route() string { return "" }

Check warning on line 41 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L41

Added line #L41 was not covered by tests

// Type implements the sdk.Msg interface.
// Type implements the LegacyMsg interface.
func (msg MsgClaim) Type() string { return sdk.MsgTypeURL(&msg) }

func NewMsgBond(account sdk.AccAddress, asset sdk.Coin) *MsgBond {
Expand All @@ -64,8 +64,8 @@
return sdk.MustSortJSON(bz)
}

// Route implements the sdk.Msg interface.
func (msg MsgBond) Route() string { return RouterKey }
// Route implements the LegacyMsg interface.
func (msg MsgBond) Route() string { return "" }

Check warning on line 68 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L68

Added line #L68 was not covered by tests

// Type implements the sdk.Msg interface.
func (msg MsgBond) Type() string { return sdk.MsgTypeURL(&msg) }
Expand All @@ -91,8 +91,8 @@
return sdk.MustSortJSON(bz)
}

// Route implements the sdk.Msg interface.
func (msg MsgBeginUnbonding) Route() string { return RouterKey }
// Route implements the LegacyMsg interface.
func (msg MsgBeginUnbonding) Route() string { return "" }

Check warning on line 95 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L95

Added line #L95 was not covered by tests

// Type implements the sdk.Msg interface.
func (msg MsgBeginUnbonding) Type() string { return sdk.MsgTypeURL(&msg) }
Expand All @@ -118,8 +118,8 @@
return sdk.MustSortJSON(bz)
}

// Route implements the sdk.Msg interface.
func (msg MsgEmergencyUnbond) Route() string { return RouterKey }
// Route implements the LegacyMsg interface.
func (msg MsgEmergencyUnbond) Route() string { return "" }

Check warning on line 122 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L122

Added line #L122 was not covered by tests

// Type implements the sdk.Msg interface.
func (msg MsgEmergencyUnbond) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down Expand Up @@ -149,8 +149,8 @@
return sdk.MustSortJSON(bz)
}

// Route implements the sdk.Msg interface.
func (msg MsgSponsor) Route() string { return RouterKey }
// Route implements the LegacyMsg interface.
func (msg MsgSponsor) Route() string { return "" }

Check warning on line 153 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L153

Added line #L153 was not covered by tests

// Type implements the sdk.Msg interface.
func (msg MsgSponsor) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down Expand Up @@ -180,8 +180,8 @@
return checkers.Signers(msg.Authority)
}

// Route implements the sdk.Msg interface.
func (msg MsgGovSetParams) Route() string { return RouterKey }
// Route implements the LegacyMsg interface.
func (msg MsgGovSetParams) Route() string { return "" }

Check warning on line 184 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L184

Added line #L184 was not covered by tests

// Type implements the sdk.Msg interface.
func (msg MsgGovSetParams) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down Expand Up @@ -219,8 +219,8 @@
return checkers.Signers(msg.Authority)
}

// Route implements the sdk.Msg interface.
func (msg MsgGovCreatePrograms) Route() string { return RouterKey }
// Route implements the LegacyMsg interface.
func (msg MsgGovCreatePrograms) Route() string { return "" }

Check warning on line 223 in x/incentive/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/incentive/msgs.go#L223

Added line #L223 was not covered by tests

// Type implements the sdk.Msg interface.
func (msg MsgGovCreatePrograms) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down
1 change: 0 additions & 1 deletion x/incentive/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func TestRoutes(t *testing.T) {
}

for _, msg := range msgs {
assert.Equal(t, "incentive", msg.Route())
// check for non-empty returns for now
assert.Assert(t, len(msg.GetSignBytes()) != 0)
// exact match required
Expand Down
26 changes: 6 additions & 20 deletions x/leverage/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -76,10 +75,6 @@ func (AppModuleBasic) ValidateGenesis(
return genState.Validate()
}

// Deprecated: RegisterRESTRoutes performs a no-op. Querying is delegated to the
// gRPC service.
func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {}

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the x/leverage
// module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
Expand Down Expand Up @@ -125,21 +120,6 @@ func (AppModule) ConsensusVersion() uint64 {
return 1
}

// Deprecated: Route returns the message routing key for the x/leverage module.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}

// QuerierRoute returns the x/leverage module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }

// LegacyQuerierHandler returns a no-op legacy querier.
func (am AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier {
return func(sdk.Context, []string, abci.RequestQuery) ([]byte, error) {
return nil, fmt.Errorf("legacy querier not supported for the x/%s module", types.ModuleName)
}
}

// RegisterServices registers gRPC services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
Expand Down Expand Up @@ -188,3 +168,9 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
func AddModuleInitFlags(startCmd *cobra.Command) {
startCmd.Flags().BoolP(types.FlagEnableLiquidatorQuery, "l", false, "enable liquidator query")
}

// DEPRECATED

func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil }
func (AppModule) QuerierRoute() string { return "" }
func (AppModule) Route() sdk.Route { return sdk.Route{} }
6 changes: 0 additions & 6 deletions x/leverage/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ const (

// StoreKey defines the primary module store key
StoreKey = ModuleName

// RouterKey is the message route
RouterKey = ModuleName

// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
)

// KVStore key prefixes
Expand Down
2 changes: 1 addition & 1 deletion x/leverage/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
func (msg *MsgGovUpdateRegistry) GetDescription() string { return msg.Description }

// GetDescription returns the routing key of a community pool spend proposal.
func (msg *MsgGovUpdateRegistry) ProposalRoute() string { return RouterKey }
func (msg *MsgGovUpdateRegistry) ProposalRoute() string { return ModuleName }

Check warning on line 23 in x/leverage/types/proposal.go

View check run for this annotation

Codecov / codecov/patch

x/leverage/types/proposal.go#L23

Added line #L23 was not covered by tests

// ProposalType returns the type of a community pool spend proposal.
func (msg *MsgGovUpdateRegistry) ProposalType() string { return proposalTypeMsgGovUpdateRegistry }
26 changes: 6 additions & 20 deletions x/oracle/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -77,10 +76,6 @@
return nil
}

// Deprecated: RegisterRESTRoutes performs a no-op. Querying is delegated to the
// gRPC service.
func (AppModuleBasic) RegisterRESTRoutes(client.Context, *mux.Router) {}

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the x/oracle
// module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
Expand Down Expand Up @@ -126,21 +121,6 @@
return am.AppModuleBasic.Name()
}

// Deprecated: Route returns the message routing key for the x/oracle module.
func (am AppModule) Route() sdk.Route {
return sdk.Route{}
}

// QuerierRoute returns the x/oracle module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }

// LegacyQuerierHandler returns a no-op legacy querier.
func (am AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier {
return func(sdk.Context, []string, abci.RequestQuery) ([]byte, error) {
return nil, fmt.Errorf("legacy querier not supported for the x/%s module", types.ModuleName)
}
}

// RegisterServices registers gRPC services.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
Expand Down Expand Up @@ -213,3 +193,9 @@
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc)
}

// DEPRECATED

func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil }

Check warning on line 199 in x/oracle/module.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/module.go#L199

Added line #L199 was not covered by tests
func (AppModule) QuerierRoute() string { return "" }
func (AppModule) Route() sdk.Route { return sdk.Route{} }
6 changes: 0 additions & 6 deletions x/oracle/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ const (

// StoreKey is the string store representation
StoreKey = ModuleName

// RouterKey is the message route for oracle module
RouterKey = ModuleName

// QuerierRoute is the query router key for the oracle module
QuerierRoute = ModuleName
)

// KVStore key prefixes
Expand Down
6 changes: 3 additions & 3 deletions x/oracle/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

// Route implements LegacyMsg interface
func (msg MsgAggregateExchangeRatePrevote) Route() string { return RouterKey }
func (msg MsgAggregateExchangeRatePrevote) Route() string { return "" }

Check warning on line 31 in x/oracle/types/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/types/msgs.go#L31

Added line #L31 was not covered by tests

// Type implements LegacyMsg interface
func (msg MsgAggregateExchangeRatePrevote) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down Expand Up @@ -83,7 +83,7 @@
}

// Route implements LegacyMsg interface
func (msg MsgAggregateExchangeRateVote) Route() string { return RouterKey }
func (msg MsgAggregateExchangeRateVote) Route() string { return "" }

Check warning on line 86 in x/oracle/types/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/types/msgs.go#L86

Added line #L86 was not covered by tests

// Type implements LegacyMsg interface
func (msg MsgAggregateExchangeRateVote) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down Expand Up @@ -148,7 +148,7 @@
}

// Route implements LegacyMsg interface
func (msg MsgDelegateFeedConsent) Route() string { return RouterKey }
func (msg MsgDelegateFeedConsent) Route() string { return "" }

Check warning on line 151 in x/oracle/types/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/types/msgs.go#L151

Added line #L151 was not covered by tests

// Type implements LegacyMsg interface
func (msg MsgDelegateFeedConsent) Type() string { return sdk.MsgTypeURL(&msg) }
Expand Down
19 changes: 6 additions & 13 deletions x/ugov/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ func (AppModule) ConsensusVersion() uint64 {
return 1
}

// LegacyQuerierHandler implements module.AppModule
func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier {
return nil
}

// QuerierRoute implements module.AppModule
func (AppModule) QuerierRoute() string { return "" }

// RegisterInvariants implements module.AppModule
func (AppModule) RegisterInvariants(sdk.InvariantRegistry) {}

Expand All @@ -132,11 +124,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
ugov.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.kb))
}

// Route implements module.AppModule
func (AppModule) Route() sdk.Route {
return sdk.Route{}
}

// BeginBlock executes all ABCI BeginBlock logic respective to the x/uibc module.
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}

Expand All @@ -145,3 +132,9 @@ func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return nil
}

// DEPRECATED

func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil }
func (AppModule) QuerierRoute() string { return "" }
func (AppModule) Route() sdk.Route { return sdk.Route{} }
19 changes: 6 additions & 13 deletions x/uibc/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ func (AppModule) ConsensusVersion() uint64 {
return 1
}

// LegacyQuerierHandler implements module.AppModule
func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier {
return nil
}

// QuerierRoute implements module.AppModule
func (AppModule) QuerierRoute() string { return "" }

// RegisterInvariants implements module.AppModule
func (AppModule) RegisterInvariants(sdk.InvariantRegistry) {}

Expand All @@ -130,11 +122,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
ibctransfer.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.kb))
}

// Route implements module.AppModule
func (AppModule) Route() sdk.Route {
return sdk.Route{}
}

// BeginBlock executes all ABCI BeginBlock logic respective to the x/uibc module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
BeginBlock(ctx, am.kb.Keeper(&ctx))
Expand All @@ -145,3 +132,9 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return EndBlocker()
}

// DEPRECATED

func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil }
func (AppModule) QuerierRoute() string { return "" }
func (AppModule) Route() sdk.Route { return sdk.Route{} }
Loading