Skip to content

Commit

Permalink
Mainnet v2 prepare branch (#26)
Browse files Browse the repository at this point in the history
* Update Makefile
* update address prefix
* Update Makefile
* update readme
* Revert "Add provider module (#1)"
This reverts commit 444d0fb.
* update readme.md
* use tsaga denom
* [readme] Fix wrong min go version in readme
* [docker] Add Dockerfile (#4)
* [docker] Add dockerfile
* [docker] Expose additional ports
* Bump ibc-go dependency (#5)
* versioning (#6)
* [docker] Add bash to docker image (#7)
* [ci][docker] Push multi-platform docker image (#8)
* Fix hardcoded version in the build command (#9)
* Enable ledger by default in Makefile (#10)
* enable ledger in makefile
* bump ledger packages
* Initial commit for public repo standards (#15)
* Initial commit for public repo standards
* Updates based on rkollar review
* Upgrade to cosmos-sdk v0.50
* Feature/ibc packet forward (#22)
* Update commands setup

---------

Co-authored-by: lukitsbrian <[email protected]>
Co-authored-by: Emanuel Mazzilli <[email protected]>
Co-authored-by: Brian <[email protected]>
Co-authored-by: Roman Kollár <[email protected]>
Co-authored-by: ashishchandr70 <[email protected]>
Co-authored-by: Ashish Chandra <[email protected]>
  • Loading branch information
7 people authored Dec 6, 2024
1 parent 4187f2d commit 5d733e9
Show file tree
Hide file tree
Showing 27 changed files with 1,437 additions and 715 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ release/
.vscode/
.DS_Store
build/
tmp/
59 changes: 59 additions & 0 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package ante

import (
errors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
sagaante "github.com/sagaxyz/saga-sdk/ante"
)

// HandlerOptions are the options required for constructing a default SDK AnteHandler.
type HandlerOptions struct {
ante.HandlerOptions

StakingKeeper sagaante.StakingKeeper
IBCKeeper *ibckeeper.Keeper
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}

if options.BankKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
}

if options.StakingKeeper == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "staking keeper is required for ante builder")
}

if options.SignModeHandler == nil {
return nil, errors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
sagaante.NewMsgFilterDecorator(sagaante.BondedValidator(options.StakingKeeper), "/ssc.peers"),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
}
Loading

0 comments on commit 5d733e9

Please sign in to comment.