Use [wasm] subsection in app.toml
This commit is contained in:
12
app/app.go
12
app/app.go
@@ -123,6 +123,12 @@ type WasmApp struct {
|
|||||||
sm *module.SimulationManager
|
sm *module.SimulationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WasmWrapper allows us to use namespacing in the config file
|
||||||
|
// This is only used for parsing in the app, x/wasm expects WasmConfig
|
||||||
|
type WasmWrapper struct {
|
||||||
|
Wasm wasm.WasmConfig `mapstructure:"wasm"`
|
||||||
|
}
|
||||||
|
|
||||||
// NewWasmApp returns a reference to an initialized WasmApp.
|
// NewWasmApp returns a reference to an initialized WasmApp.
|
||||||
func NewWasmApp(
|
func NewWasmApp(
|
||||||
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
||||||
@@ -183,11 +189,13 @@ func NewWasmApp(
|
|||||||
homeDir := viper.GetString(cli.HomeFlag)
|
homeDir := viper.GetString(cli.HomeFlag)
|
||||||
wasmDir := filepath.Join(homeDir, "wasm")
|
wasmDir := filepath.Join(homeDir, "wasm")
|
||||||
|
|
||||||
wasmConfig := wasm.DefaultWasmConfig()
|
wasmWrap := WasmWrapper{Wasm: wasm.DefaultWasmConfig()}
|
||||||
err := viper.Unmarshal(&wasmConfig)
|
err := viper.Unmarshal(&wasmWrap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("error while reading wasm config:", err.Error())
|
fmt.Println("error while reading wasm config:", err.Error())
|
||||||
}
|
}
|
||||||
|
wasmConfig := wasmWrap.Wasm
|
||||||
|
fmt.Printf("WasmConfig: %#v\n", wasmConfig)
|
||||||
|
|
||||||
app.wasmKeeper = wasm.NewKeeper(app.cdc, keys[wasm.StoreKey], app.accountKeeper, app.bankKeeper, wasmRouter, wasmDir, wasmConfig)
|
app.wasmKeeper = wasm.NewKeeper(app.cdc, keys[wasm.StoreKey], app.accountKeeper, app.bankKeeper, wasmRouter, wasmDir, wasmConfig)
|
||||||
|
|
||||||
|
|||||||
28
x/wasm/README.md
Normal file
28
x/wasm/README.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Wasm Module
|
||||||
|
|
||||||
|
This should be a brief overview of the functionality
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
You can add the following section to `config/app.toml`. Below is shown with defaults:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[wasm]
|
||||||
|
# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
|
||||||
|
query_gas_limit = 300000
|
||||||
|
# This is the number of wasm vm instances we keep cached in memory for speed-up
|
||||||
|
# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally
|
||||||
|
lru_size = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Messages
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## CLI
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## Rest
|
||||||
|
|
||||||
|
TODO
|
||||||
Reference in New Issue
Block a user