Skip to content

Commit

Permalink
Merge pull request #14 from AllInBetsCom/callback
Browse files Browse the repository at this point in the history
merge conflicts resolved
  • Loading branch information
rockstarRhino authored Jul 16, 2024
2 parents 288edd9 + c153aff commit 8b334e0
Show file tree
Hide file tree
Showing 9 changed files with 444 additions and 241 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ To setup push hooks, run the following command:

```sh
./scripts/setup_push_hooks.sh
```
```
22 changes: 15 additions & 7 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package app

import (
errorsmod "cosmossdk.io/errors"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

conntypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"

errorsmod "cosmossdk.io/errors"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/dymensionxyz/dymension-rdk/x/gasless"
gaslesskeeper "github.com/dymensionxyz/dymension-rdk/x/gasless/keeper"
cosmosante "github.com/evmos/evmos/v12/app/ante/cosmos"
)

// HandlerOptions are the options required for constructing a default SDK AnteHandler.
Expand All @@ -21,6 +23,7 @@ type HandlerOptions struct {
IBCKeeper *ibckeeper.Keeper
WasmConfig *wasmtypes.WasmConfig
TxCounterStoreKey storetypes.StoreKey
GaslessKeeper gaslesskeeper.Keeper
}

func GetAnteDecorators(options HandlerOptions) []sdk.AnteDecorator {
Expand All @@ -31,6 +34,11 @@ func GetAnteDecorators(options HandlerOptions) []sdk.AnteDecorator {

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
cosmosante.NewRejectMessagesDecorator(
[]string{
sdk.MsgTypeURL(&conntypes.MsgConnectionOpenInit{}), // don't let any connection open from the Rollapp side (it's still possible from the other side)
},
),
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
Expand All @@ -40,7 +48,7 @@ func GetAnteDecorators(options HandlerOptions) []sdk.AnteDecorator {

ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
gasless.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker, options.GaslessKeeper),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
Expand All @@ -57,7 +65,7 @@ func GetAnteDecorators(options HandlerOptions) []sdk.AnteDecorator {
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
//From x/auth/ante.go
// From x/auth/ante.go
if options.AccountKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}
Expand Down
Loading

0 comments on commit 8b334e0

Please sign in to comment.