Skip to content

Commit e4a2086

Browse files
authored
modify wasm gas multiplier to make wasm executes more in line with compute cost (#773)
* modify wasm gas multiplier to make wasm executes more in line with compute cost * update comment and value
1 parent 43b4c04 commit e4a2086

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmd/seid/cmd/root.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/CosmWasm/wasmd/x/wasm"
14+
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
1415
"github.com/cosmos/cosmos-sdk/baseapp"
1516
"github.com/cosmos/cosmos-sdk/client"
1617
"github.com/cosmos/cosmos-sdk/client/config"
@@ -251,6 +252,12 @@ func newApp(
251252
panic(err)
252253
}
253254

255+
wasmGasRegisterConfig := wasmkeeper.DefaultGasRegisterConfig()
256+
// This varies from the default value of 140_000_000 because we would like to appropriately represent the
257+
// compute time required as a proportion of block gas used for a wasm contract that performs a lot of compute
258+
// This makes it such that the wasm VM gas converts to sdk gas at a 6.66x rate vs that of the previous multiplier
259+
wasmGasRegisterConfig.GasMultiplier = 21_000_000
260+
254261
return app.New(
255262
logger,
256263
db,
@@ -263,7 +270,13 @@ func newApp(
263270
app.MakeEncodingConfig(),
264271
wasm.EnableAllProposals,
265272
appOpts,
266-
[]wasm.Option{},
273+
[]wasm.Option{
274+
wasmkeeper.WithGasRegister(
275+
wasmkeeper.NewWasmGasRegister(
276+
wasmGasRegisterConfig,
277+
),
278+
),
279+
},
267280
[]aclkeeper.Option{},
268281
baseapp.SetPruning(pruningOpts),
269282
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),

0 commit comments

Comments
 (0)