Skip to content

Commit

Permalink
Wasmd updates (osmosis-labs#934)
Browse files Browse the repository at this point in the history
* Bump wasmd to 0.23.0

* Add simulation gas limit ante decorator
  • Loading branch information
ethanfrey authored Feb 22, 2022
1 parent 316cec5 commit ca90830
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
10 changes: 7 additions & 3 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package app
import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"

ante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

ante "github.com/cosmos/cosmos-sdk/x/auth/ante"

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

wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"

txfeeskeeper "github.com/osmosis-labs/osmosis/v7/x/txfees/keeper"
txfeestypes "github.com/osmosis-labs/osmosis/v7/x/txfees/types"
)
Expand All @@ -19,6 +21,7 @@ import (
// https://github.com/cosmos/cosmos-sdk/blob/v0.43.0/x/auth/ante/ante.go#L41
func NewAnteHandler(
appOpts servertypes.AppOptions,
wasmConfig wasm.Config,
ak ante.AccountKeeper, bankKeeper authtypes.BankKeeper,
txFeesKeeper *txfeeskeeper.Keeper, spotPriceCalculator txfeestypes.SpotPriceCalculator,
sigGasConsumer ante.SignatureVerificationGasConsumer,
Expand All @@ -29,6 +32,7 @@ func NewAnteHandler(
mempoolFeeDecorator := txfeeskeeper.NewMempoolFeeDecorator(*txFeesKeeper, mempoolFeeOptions)
return sdk.ChainAnteDecorators(
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(wasmConfig.SimulationGasLimit),
ante.NewRejectExtensionOptionsDecorator(),
// Use Mempool Fee Decorator from our txfees module instead of default one from auth
// https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/middleware/fee.go#L34
Expand Down
9 changes: 8 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,15 @@ func NewOsmosisApp(
memKeys: memKeys,
}

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
panic(fmt.Sprintf("error while reading wasm config: %s", err))
}

app.InitSpecialKeepers(skipUpgradeHeights, homePath, invCheckPeriod)
app.setupUpgradeStoreLoaders()
app.InitNormalKeepers(homePath, appOpts, wasmEnabledProposals, wasmOpts)
app.InitNormalKeepers(wasmDir, wasmConfig, wasmEnabledProposals, wasmOpts)
app.SetupHooks()

/**** Module Options ****/
Expand Down Expand Up @@ -625,6 +631,7 @@ func NewOsmosisApp(
app.SetAnteHandler(
NewAnteHandler(
appOpts,
wasmConfig,
app.AccountKeeper, app.BankKeeper,
app.TxFeesKeeper, app.GAMMKeeper,
ante.DefaultSigVerificationGasConsumer,
Expand Down
14 changes: 2 additions & 12 deletions app/keepers.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package app

import (
"fmt"
"path/filepath"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/baseapp"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
Expand Down Expand Up @@ -113,8 +109,8 @@ func (app *OsmosisApp) InitSpecialKeepers(

// Note: I put x/wasm here as I need to write it up to these other ones
func (app *OsmosisApp) InitNormalKeepers(
homePath string,
appOpts servertypes.AppOptions,
wasmDir string,
wasmConfig wasm.Config,
wasmEnabledProposals []wasm.ProposalType,
wasmOpts []wasm.Option,
) {
Expand Down Expand Up @@ -271,12 +267,6 @@ func (app *OsmosisApp) InitNormalKeepers(
)
app.TxFeesKeeper = &txFeesKeeper

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
panic(fmt.Sprintf("error while reading wasm config: %s", err))
}

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
supportedFeatures := "iterator,staking,stargate"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/osmosis-labs/osmosis/v7
go 1.17

require (
github.com/CosmWasm/wasmd v0.22.0
github.com/CosmWasm/wasmd v0.23.0
github.com/cosmos/cosmos-sdk v0.45.1
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/iavl v0.17.3
Expand Down

0 comments on commit ca90830

Please sign in to comment.