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

Upgraded cosmos version to v0.44 #64

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions application/ante_handler.go
@@ -0,0 +1,51 @@
package application

import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcChannelKeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper"
ibcCoreAnte "github.com/cosmos/ibc-go/v2/modules/core/ante"
)

type HandlerOptions struct {
ante.HandlerOptions
IBCChannelKeeper ibcChannelKeeper.Keeper
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

var sigGasConsumer = options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(),
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcCoreAnte.NewAnteDecorator(options.IBCChannelKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
}
21 changes: 16 additions & 5 deletions application/application.go
Expand Up @@ -10,19 +10,18 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
sdkAuthzModule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
distributionClient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distributionTypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
sdkFeegrantModule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
govTypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer"
ibcTransferTypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
ibc "github.com/cosmos/cosmos-sdk/x/ibc/core"
"github.com/cosmos/cosmos-sdk/x/mint"
mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
Expand All @@ -32,7 +31,12 @@ import (
stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeClient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
"github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibcTransferTypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
ibcClient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client"
"github.com/persistenceOne/persistenceCore/x/halving"
strangeLoveRouter "github.com/strangelove-ventures/packet-forward-middleware/router"
)

var ModuleAccountPermissions = map[string][]string{
Expand All @@ -54,16 +58,23 @@ var ModuleBasics = module.NewBasicManager(
mint.AppModuleBasic{},
distribution.AppModuleBasic{},
gov.NewAppModuleBasic(
paramsClient.ProposalHandler, distributionClient.ProposalHandler, upgradeClient.ProposalHandler, upgradeClient.CancelProposalHandler,
paramsClient.ProposalHandler,
distributionClient.ProposalHandler,
upgradeClient.ProposalHandler,
upgradeClient.CancelProposalHandler,
ibcClient.UpdateClientProposalHandler,
ibcClient.UpgradeProposalHandler,
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
sdkFeegrantModule.AppModuleBasic{},
sdkAuthzModule.AppModuleBasic{},
ibc.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
arhamchordia marked this conversation as resolved.
Show resolved Hide resolved
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},

strangeLoveRouter.AppModuleBasic{},
halving.AppModuleBasic{},
)