-
Notifications
You must be signed in to change notification settings - Fork 538
/
config.go
42 lines (37 loc) · 1.83 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package types
import "path/filepath"
const (
// ContractMemoryLimit is the memory limit of each contract execution (in MiB)
// constant value so all nodes run with the same limit.
ContractMemoryLimit = 32
// MemoryCacheSize is the size of the wasm vm cache (in MiB), it is set to 0 to reduce unnecessary memory usage.
// See: https://github.com/CosmWasm/cosmwasm/pull/1925
MemoryCacheSize = 0
defaultDataDir string = "ibc_08-wasm_client_data"
defaultSupportedCapabilities string = "iterator"
defaultContractDebugMode = false
)
// WasmConfig defines configuration parameters for the 08-wasm wasm virtual machine instance.
// It includes the `dataDir` intended to be used for wasm blobs and internal caches, as well as a comma separated list
// of features or capabilities the user wishes to enable. A boolean flag is provided to enable debug mode.
type WasmConfig struct {
// DataDir is the directory for Wasm blobs and various caches
DataDir string
// SupportedCapabilities 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.
SupportedCapabilities string
// 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.
// The homePath is the path to the directory where the data directory for
// Wasm blobs and caches will be stored.
func DefaultWasmConfig(homePath string) WasmConfig {
return WasmConfig{
DataDir: filepath.Join(homePath, defaultDataDir),
SupportedCapabilities: defaultSupportedCapabilities,
ContractDebugMode: defaultContractDebugMode,
}
}