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

Bump cosmos-sdk & wasm #130

Merged
merged 7 commits into from
Oct 9, 2021
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
45 changes: 24 additions & 21 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
Expand All @@ -23,34 +24,36 @@ import (
opbkeeper "github.com/bianjieai/irita/modules/opb/keeper"
)

type HandlerOptions struct {
permKeeper perm.Keeper
accountKeeper authkeeper.AccountKeeper
bankKeeper bankkeeper.Keeper
feegrantKeeper authante.FeegrantKeeper
tokenKeeper tokenkeeper.Keeper
opbKeeper opbkeeper.Keeper
sigGasConsumer ante.SignatureVerificationGasConsumer
signModeHandler signing.SignModeHandler
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, deducts fees from the first
// signer, and performs other module-specific logic.
func NewAnteHandler(
permKeeper perm.Keeper,
ak authkeeper.AccountKeeper,
bankKeeper bankkeeper.Keeper,
tokenKeeper tokenkeeper.Keeper,
opbKeeper opbkeeper.Keeper,
sigGasConsumer ante.SignatureVerificationGasConsumer,
signModeHandler signing.SignModeHandler,
) sdk.AnteHandler {
func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
perm.NewAuthDecorator(permKeeper),
perm.NewAuthDecorator(options.permKeeper),
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewValidateMemoDecorator(ak),
ante.NewConsumeGasForTxSizeDecorator(ak),
ante.NewRejectFeeGranterDecorator(),
ante.NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(ak),
ante.NewDeductFeeDecorator(ak, bankKeeper),
ante.NewSigGasConsumeDecorator(ak, sigGasConsumer),
ante.NewSigVerificationDecorator(ak, signModeHandler),
ante.NewIncrementSequenceDecorator(ak),
tokenkeeper.NewValidateTokenFeeDecorator(tokenKeeper, bankKeeper),
opbkeeper.NewValidateTokenTransferDecorator(opbKeeper, tokenKeeper),
ante.NewValidateMemoDecorator(options.accountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.accountKeeper),
ante.NewSetPubKeyDecorator(options.accountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.accountKeeper),
ante.NewDeductFeeDecorator(options.accountKeeper, options.bankKeeper, options.feegrantKeeper),
ante.NewSigGasConsumeDecorator(options.accountKeeper, options.sigGasConsumer),
ante.NewSigVerificationDecorator(options.accountKeeper, options.signModeHandler),
ante.NewIncrementSequenceDecorator(options.accountKeeper),
tokenkeeper.NewValidateTokenFeeDecorator(options.tokenKeeper, options.bankKeeper),
opbkeeper.NewValidateTokenTransferDecorator(options.opbKeeper, options.tokenKeeper),
)
}

Expand Down
Loading