Remove hybrid codec usage (#6843)
* remove hybrid codec for slashing, staking and upgrade * Remove hybridcodec from params and mint * revert staking * Fix gov * Fix ibc and evidence * Fix ibc-transfer * Fix staking * remove evidence json marshaling * Fix tests Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Aaron Craelius
Aaron Craelius
Federico Kunze
parent
c6f3a1706f
commit
3bafd8255a
@@ -4,7 +4,6 @@ import (
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
@@ -12,11 +11,11 @@ import (
|
||||
)
|
||||
|
||||
// NewQuerier returns a new querier handler for the x/params module.
|
||||
func NewQuerier(k Keeper) sdk.Querier {
|
||||
func NewQuerier(k Keeper, legacyQuerierCdc codec.JSONMarshaler) sdk.Querier {
|
||||
return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) {
|
||||
switch path[0] {
|
||||
case types.QueryParams:
|
||||
return queryParams(ctx, req, k)
|
||||
return queryParams(ctx, req, k, legacyQuerierCdc)
|
||||
|
||||
default:
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0])
|
||||
@@ -24,10 +23,10 @@ func NewQuerier(k Keeper) sdk.Querier {
|
||||
}
|
||||
}
|
||||
|
||||
func queryParams(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) {
|
||||
func queryParams(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc codec.JSONMarshaler) ([]byte, error) {
|
||||
var params types.QuerySubspaceParams
|
||||
|
||||
if err := legacy.Cdc.UnmarshalJSON(req.Data, ¶ms); err != nil {
|
||||
if err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms); err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
|
||||
}
|
||||
|
||||
@@ -39,7 +38,7 @@ func queryParams(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, erro
|
||||
rawValue := ss.GetRaw(ctx, []byte(params.Key))
|
||||
resp := types.NewSubspaceParamsResponse(params.Subspace, params.Key, string(rawValue))
|
||||
|
||||
bz, err := codec.MarshalJSONIndent(legacy.Cdc, resp)
|
||||
bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, resp)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
|
||||
}
|
||||
|
||||
+2
-2
@@ -97,8 +97,8 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) {}
|
||||
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
|
||||
|
||||
// LegacyQuerierHandler returns the x/params querier handler.
|
||||
func (am AppModule) LegacyQuerierHandler(codec.JSONMarshaler) sdk.Querier {
|
||||
return keeper.NewQuerier(am.keeper)
|
||||
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc codec.JSONMarshaler) sdk.Querier {
|
||||
return keeper.NewQuerier(am.keeper, legacyQuerierCdc)
|
||||
}
|
||||
|
||||
// RegisterQueryService registers a gRPC query service to respond to the
|
||||
|
||||
Reference in New Issue
Block a user