Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(simapp,confix): change example of custom app.toml extension #18496

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions simapp/simd/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import (
func initCometBFTConfig() *cmtcfg.Config {
cfg := cmtcfg.DefaultConfig()

// only display only error logs by default except for p2p and state
cfg.LogLevel = "*:error,p2p:info,state:info"
Copy link
Member Author

@julienrbrt julienrbrt Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought you may like this @tac0turtle as a default for a prettier simapp logger, but does not change the SDK default.=


// these values put a higher strain on node memory
// cfg.P2P.MaxNumInboundPeers = 100
// cfg.P2P.MaxNumOutboundPeers = 40
Expand Down Expand Up @@ -70,19 +73,18 @@ gas-adjustment = {{ .GasConfig.GasAdjustment }}
func initAppConfig() (string, interface{}) {
// The following code snippet is just for reference.

// WASMConfig defines configuration for the wasm module.
type WASMConfig struct {
// This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
QueryGasLimit uint64 `mapstructure:"query-gas-limit"`

// Address defines the gRPC-web server to listen on
LruSize uint64 `mapstructure:"lru-size"`
// CustomConfig defines an arbitrary custom config to extend app.toml.
// If you don't need it, you can remove it.
// If you wish to add fields that correspond to flags that aren't in the SDK server config,
// this custom config can as well help.
type CustomConfig struct {
CustomField string `mapstructure:"custom-field"`
}

type CustomAppConfig struct {
serverconfig.Config `mapstructure:",squash"`

WASM WASMConfig `mapstructure:"wasm"`
Custom CustomConfig `mapstructure:"custom"`
}

// Optionally allow the chain developer to overwrite the SDK's default
Expand All @@ -96,7 +98,7 @@ func initAppConfig() (string, interface{}) {
// In summary:
// - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
// own app.toml config,
// - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
// - if you set srvCfg.MinGasPrices non-empty, validatorcan be used to extend the app.toml.s CAN tweak their
// own app.toml to override, or use this default value.
//
// In simapp, we set the min gas prices to 0.
Expand All @@ -106,22 +108,19 @@ func initAppConfig() (string, interface{}) {
// Now we set the custom config default values.
customAppConfig := CustomAppConfig{
Config: *srvCfg,
WASM: WASMConfig{
LruSize: 1,
QueryGasLimit: 300000,
Custom: CustomConfig{
CustomField: "anything",
},
}

// The default SDK app template is defined in serverconfig.DefaultConfigTemplate.
// We append the custom config template to the default one.
// And we set the default config to the custom app template.
customAppTemplate := serverconfig.DefaultConfigTemplate + `
[wasm]
# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
query-gas-limit = {{ .WASM.QueryGasLimit }}
# 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 = {{ .WASM.LruSize }}`
[custom]
# That field will be parsed by server.InterceptConfigsPreRunHandler and held by viper.
# Do not forget to add quotes around the value if it is a string.
custom-field = "{{ .Custom.CustomField }}"`

return customAppTemplate, customAppConfig
}
2 changes: 2 additions & 0 deletions tools/confix/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

* []() Remove invalid non SDK config from app.toml migration templates.

## [v0.1.0](https://github.com/cosmos/cosmos-sdk/releases/tag/tools/confix/v0.1.0) - 2023-11-07

* [#17904](https://github.com/cosmos/cosmos-sdk/pull/17904) Add `view` command.
Expand Down
12 changes: 2 additions & 10 deletions tools/confix/data/v0.45-app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ prometheus-retention-time = 0
#
# Example:
# [["chain_id", "cosmoshub-1"]]
global-labels = [
]
global-labels = []

###############################################################################
### API Configuration ###
Expand Down Expand Up @@ -208,7 +207,7 @@ streamers = []

[streamers]
[streamers.file]
keys = ["*", ]
keys = ["*"]
write_dir = ""
prefix = ""

Expand All @@ -221,10 +220,3 @@ stop-node-on-error = "true"

# fsync specifies if call fsync after writing the files.
fsync = "false"

[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
12 changes: 2 additions & 10 deletions tools/confix/data/v0.46-app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ prometheus-retention-time = 0
#
# Example:
# [["chain_id", "cosmoshub-1"]]
global-labels = [
]
global-labels = []

###############################################################################
### API Configuration ###
Expand Down Expand Up @@ -237,7 +236,7 @@ streamers = []

[streamers]
[streamers.file]
keys = ["*", ]
keys = ["*"]
write_dir = ""
prefix = ""

Expand All @@ -250,10 +249,3 @@ stop-node-on-error = "true"

# fsync specifies if call fsync after writing the files.
fsync = "false"

[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
7 changes: 0 additions & 7 deletions tools/confix/data/v0.47-app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,3 @@ fsync = "false"
# Note, this configuration only applies to SDK built-in app-side mempool
# implementations.
max-txs = 5000

[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
7 changes: 0 additions & 7 deletions tools/confix/data/v0.50-app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,3 @@ stop-node-on-err = true
# Note, this configuration only applies to SDK built-in app-side mempool
# implementations.
max-txs = 5000

[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
Loading