Skip to content

Commit

Permalink
modify wasm gas multiplier to make wasm executes more in line with co…
Browse files Browse the repository at this point in the history
…mpute cost (#773)

* modify wasm gas multiplier to make wasm executes more in line with compute cost

* update comment and value
  • Loading branch information
udpatil authored May 16, 2023
1 parent 43b4c04 commit e4a2086
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/seid/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand Down Expand Up @@ -251,6 +252,12 @@ func newApp(
panic(err)
}

wasmGasRegisterConfig := wasmkeeper.DefaultGasRegisterConfig()
// This varies from the default value of 140_000_000 because we would like to appropriately represent the
// compute time required as a proportion of block gas used for a wasm contract that performs a lot of compute
// This makes it such that the wasm VM gas converts to sdk gas at a 6.66x rate vs that of the previous multiplier
wasmGasRegisterConfig.GasMultiplier = 21_000_000

return app.New(
logger,
db,
Expand All @@ -263,7 +270,13 @@ func newApp(
app.MakeEncodingConfig(),
wasm.EnableAllProposals,
appOpts,
[]wasm.Option{},
[]wasm.Option{
wasmkeeper.WithGasRegister(
wasmkeeper.NewWasmGasRegister(
wasmGasRegisterConfig,
),
),
},
[]aclkeeper.Option{},
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
Expand Down

0 comments on commit e4a2086

Please sign in to comment.