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

[Feature] add ibc ante to prevent duplicate packet from relayer #583

Merged
merged 1 commit into from
Oct 21, 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
15 changes: 8 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,14 @@ func NewTerraApp(

anteHandler, err := customante.NewAnteHandler(
customante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
FeegrantKeeper: app.FeeGrantKeeper,
OracleKeeper: app.OracleKeeper,
TreasuryKeeper: app.TreasuryKeeper,
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
FeegrantKeeper: app.FeeGrantKeeper,
OracleKeeper: app.OracleKeeper,
TreasuryKeeper: app.TreasuryKeeper,
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
IBCChannelKeeper: app.IBCKeeper.ChannelKeeper,
},
)
if err != nil {
Expand Down
19 changes: 12 additions & 7 deletions custom/auth/ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package ante

import (
channelkeeper "github.com/cosmos/ibc-go/modules/core/04-channel/keeper"
ibcante "github.com/cosmos/ibc-go/modules/core/ante"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand All @@ -10,13 +13,14 @@ import (

// HandlerOptions are the options required for constructing a default SDK AnteHandler.
type HandlerOptions struct {
AccountKeeper cosmosante.AccountKeeper
BankKeeper types.BankKeeper
FeegrantKeeper cosmosante.FeegrantKeeper
OracleKeeper OracleKeeper
TreasuryKeeper TreasuryKeeper
SignModeHandler signing.SignModeHandler
SigGasConsumer cosmosante.SignatureVerificationGasConsumer
AccountKeeper cosmosante.AccountKeeper
BankKeeper types.BankKeeper
FeegrantKeeper cosmosante.FeegrantKeeper
OracleKeeper OracleKeeper
TreasuryKeeper TreasuryKeeper
SignModeHandler signing.SignModeHandler
SigGasConsumer cosmosante.SignatureVerificationGasConsumer
IBCChannelKeeper channelkeeper.Keeper
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
Expand Down Expand Up @@ -63,5 +67,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
cosmosante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
cosmosante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
cosmosante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewAnteDecorator(options.IBCChannelKeeper),
), nil
}