Move max callback gas

This commit is contained in:
Christoph Otter
2024-05-10 18:37:44 +02:00
parent 1a1809c2be
commit aac2264a80
2 changed files with 7 additions and 6 deletions

View File

@@ -142,10 +142,6 @@ const appName = "WasmApp"
var (
NodeDir = ".wasmd"
Bech32Prefix = "wasm"
// MaxIBCCallbackGas is the maximum gas that an IBC callback can use.
// If the callback uses more gas, it will be out of gas and will not be reverted.
// This is passed to the callbacks middleware
MaxIBCCallbackGas = uint64(1000000)
)
// These constants are derived from the above variables.
@@ -670,7 +666,7 @@ func NewWasmApp(
icaControllerStack = icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper)
// app.ICAAuthModule = icaControllerStack.(ibcmock.IBCModule)
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper)
icaControllerStack = ibccallbacks.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper, wasmStackIBCHandler, MaxIBCCallbackGas)
icaControllerStack = ibccallbacks.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper, wasmStackIBCHandler, wasm.DefaultMaxIBCCallbackGas)
icaICS4Wrapper := icaControllerStack.(porttypes.ICS4Wrapper)
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper)
// Since the callbacks middleware itself is an ics4wrapper, it needs to be passed to the ica controller keeper
@@ -685,7 +681,7 @@ func NewWasmApp(
// Create Transfer Stack
var transferStack porttypes.IBCModule
transferStack = transfer.NewIBCModule(app.TransferKeeper)
transferStack = ibccallbacks.NewIBCMiddleware(transferStack, app.IBCFeeKeeper, wasmStackIBCHandler, MaxIBCCallbackGas)
transferStack = ibccallbacks.NewIBCMiddleware(transferStack, app.IBCFeeKeeper, wasmStackIBCHandler, wasm.DefaultMaxIBCCallbackGas)
transferICS4Wrapper := transferStack.(porttypes.ICS4Wrapper)
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper)
// Since the callbacks middleware itself is an ics4wrapper, it needs to be passed to the ica controller keeper

View File

@@ -20,6 +20,11 @@ import (
"github.com/CosmWasm/wasmd/x/wasm/types"
)
// DefaultMaxIBCCallbackGas is the default value of maximum gas that an IBC callback can use.
// If the callback uses more gas, it will be out of gas and will not be reverted.
// Pass this to the callbacks middleware or choose a custom value.
const DefaultMaxIBCCallbackGas = uint64(1000000)
var _ porttypes.IBCModule = IBCHandler{}
// internal interface that is implemented by ibc middleware