-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 08-wasm Keeper constructor that accepts pointer to Wasm VM instan…
…ce (#4109) * add constructor that accepts pointer to Wasm VM instance * typo * add functions that returns wasm config with default values * review comment * Apply suggestions from code review Co-authored-by: Cian Hatton <cian@interchain.io> * review comments * rename constructor function * address review comments * set contract debug mode to false --------- Co-authored-by: Cian Hatton <cian@interchain.io>
- Loading branch information
1 parent
54f29ee
commit c4f8da4
Showing
4 changed files
with
101 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package types | ||
|
||
const ( | ||
// contractMemoryLimit is the memory limit of each contract execution (in MiB) | ||
// constant value so all nodes run with the same limit. | ||
ContractMemoryLimit = 32 | ||
|
||
defaultDataDir string = "ibc_08-wasm_client_data" | ||
defaultSupportedFeatures string = "iterator" | ||
defaultMemoryCacheSize uint32 = 256 // in MiB | ||
defaultContractDebugMode = false | ||
) | ||
|
||
type WasmConfig struct { | ||
// DataDir is the directory for Wasm blobs and various caches | ||
DataDir string | ||
// SupportedFeatures is a comma separated list of capabilities supported by the chain | ||
// See https://github.com/CosmWasm/wasmd/blob/e5049ba686ab71164a01f6e71e54347710a1f740/app/wasm.go#L3-L15 | ||
// for more information. | ||
SupportedFeatures string | ||
// MemoryCacheSize in MiB not bytes. It is not consensus-critical and should | ||
// be defined on a per-node basis, often 100-1000 MB. | ||
MemoryCacheSize uint32 | ||
// ContractDebugMode is a flag to log what contracts print. It must be false on all | ||
// production nodes, and only enabled in test environments or debug non-validating nodes. | ||
ContractDebugMode bool | ||
} | ||
|
||
// DefaultWasmConfig returns the default settings for WasmConfig | ||
func DefaultWasmConfig() WasmConfig { | ||
return WasmConfig{ | ||
DataDir: defaultDataDir, | ||
SupportedFeatures: defaultSupportedFeatures, | ||
MemoryCacheSize: defaultMemoryCacheSize, | ||
ContractDebugMode: defaultContractDebugMode, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters