Skip to content

Commit

Permalink
bump wasmvm to v0.16.6
Browse files Browse the repository at this point in the history
  • Loading branch information
yun-yeo committed Apr 1, 2022
1 parent 70c1ef6 commit 40ba3cf
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 23 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ go 1.17
module github.com/terra-money/core

require (
github.com/CosmWasm/wasmvm v0.16.3
github.com/CosmWasm/wasmvm v0.16.6
github.com/cosmos/cosmos-sdk v0.44.5
github.com/cosmos/ibc-go v1.1.5
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -121,7 +121,6 @@ require (

replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
github.com/CosmWasm/wasmvm => github.com/terra-money/wasmvm v0.16.4
github.com/cosmos/cosmos-sdk => github.com/terra-money/cosmos-sdk v0.44.5-terra.2
github.com/cosmos/ledger-cosmos-go => github.com/terra-money/ledger-terra-go v0.11.2
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/CosmWasm/wasmvm v0.16.6 h1:YEqno8DJifj+1NixXSJGOXCKGX4Qb4kdYK1+JIHLpog=
github.com/CosmWasm/wasmvm v0.16.6/go.mod h1:saGLYYSj6rRVFL6EaWZHzXbLD3Rgn8ZEK+0H+UjKOE4=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
Expand Down Expand Up @@ -803,8 +805,6 @@ github.com/terra-money/ledger-terra-go v0.11.2 h1:BVXZl+OhJOri6vFNjjVaTabRLApw9M
github.com/terra-money/ledger-terra-go v0.11.2/go.mod h1:ClJ2XMj1ptcnONzKH+GhVPi7Y8pXIT+UzJ0TNt0tfZE=
github.com/terra-money/tendermint v0.34.14-terra.2 h1:UYDDCI001ZNhs+aX09HjKVldUcz084q3RwLHUOSSZQU=
github.com/terra-money/tendermint v0.34.14-terra.2/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0=
github.com/terra-money/wasmvm v0.16.4 h1:7zPlIV9zFy4NH+kfV2Yu9o5pMuD6rK36Fmdw4/CLur0=
github.com/terra-money/wasmvm v0.16.4/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A=
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
Expand Down
13 changes: 0 additions & 13 deletions x/wasm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const (
DefaultContractQueryGasLimit = uint64(3000000)
DefaultContractDebugMode = false
DefaultContractMemoryCacheSize = uint32(100)
DefaultRefreshThreadNum = uint32(16)
)

// DBDir used to store wasm data to
Expand All @@ -29,11 +28,6 @@ type Config struct {

// The WASM VM memory cache size in MiB not bytes
ContractMemoryCacheSize uint32 `mapstructure:"contract-memory-cache-size"`

// The number of background thread to refresh wasm cache.
// This background thread is to prevent memory leak which
// comes from reusing wasm module.
RefreshThreadNum uint32 `mapstructure:"refresh-thread-num"`
}

// DefaultConfig returns the default settings for WasmConfig
Expand All @@ -42,7 +36,6 @@ func DefaultConfig() *Config {
ContractQueryGasLimit: DefaultContractQueryGasLimit,
ContractDebugMode: DefaultContractDebugMode,
ContractMemoryCacheSize: DefaultContractMemoryCacheSize,
RefreshThreadNum: DefaultRefreshThreadNum,
}
}

Expand All @@ -52,7 +45,6 @@ func GetConfig(appOpts servertypes.AppOptions) *Config {
ContractQueryGasLimit: cast.ToUint64(appOpts.Get("wasm.contract-query-gas-limit")),
ContractDebugMode: cast.ToBool(appOpts.Get("wasm.contract-debug-mode")),
ContractMemoryCacheSize: cast.ToUint32(appOpts.Get("wasm.contract-memory-cache-size")),
RefreshThreadNum: cast.ToUint32(appOpts.Get("wasm.refresh-thread-num")),
}
}

Expand All @@ -69,9 +61,4 @@ contract-debug-mode = "{{ .WASMConfig.ContractDebugMode }}"
# The WASM VM memory cache size in MiB not bytes
contract-memory-cache-size = "{{ .WASMConfig.ContractMemoryCacheSize }}"
# The number of background thread to refresh wasm cache.
# This background thread is to prevent memory leak which
# comes from reusing wasm module.
refresh-thread-num = "{{ .WASMConfig.RefreshThreadNum }}"
`
6 changes: 0 additions & 6 deletions x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,12 @@ func NewKeeper(
wasmConfig.ContractMemoryCacheSize = config.DefaultContractMemoryCacheSize
}

// prevent zero refresh thread
if wasmConfig.RefreshThreadNum == 0 {
wasmConfig.RefreshThreadNum = config.DefaultRefreshThreadNum
}

vm, err := wasmvm.NewVM(
filepath.Join(homePath, config.DBDir),
supportedFeatures,
types.ContractMemoryLimit,
wasmConfig.ContractDebugMode,
wasmConfig.ContractMemoryCacheSize,
wasmConfig.RefreshThreadNum,
)

if err != nil {
Expand Down

0 comments on commit 40ba3cf

Please sign in to comment.