Skip to content

Commit

Permalink
bug(app config): fix the wrong bypass-min-fee-msg-types key parse f…
Browse files Browse the repository at this point in the history
…rom the app config file (backport #1728) (#1740)

* bug(app config): fix the wrong `bypass-min-fee-msg-types` key parse from the app config file (#1728)

* fix wrong `bypass-min-fee-msg-types` key parse from the app config file

* add the Gaia config at the second line of the file

* remove unused global var `StateSyncKey`

(cherry picked from commit b50d37c)

# Conflicts:
#	app/app.go
#	cmd/gaiad/cmd/root.go

* resolve conflicts

Co-authored-by: Danilo Pantani <[email protected]>
  • Loading branch information
mergify[bot] and Pantani authored Oct 24, 2022
1 parent 5db8fcc commit d75104c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions app/params/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package params

import (
"strings"

serverconfig "github.com/cosmos/cosmos-sdk/server/config"
)

Expand All @@ -10,9 +12,8 @@ var (
//nolint: gosec
BypassMinFeeMsgTypesKey = "bypass-min-fee-msg-types"

// CustomConfigTemplate defines Gaia's custom application configuration TOML
// template. It extends the core SDK template.
CustomConfigTemplate = serverconfig.DefaultConfigTemplate + `
// customGaiaConfigTemplate defines Gaia's custom application configuration TOML template.
customGaiaConfigTemplate = `
###############################################################################
### Custom Gaia Configuration ###
###############################################################################
Expand All @@ -25,6 +26,16 @@ bypass-min-fee-msg-types = [{{ range .BypassMinFeeMsgTypes }}{{ printf "%q, " .
`
)

// CustomConfigTemplate defines Gaia's custom application configuration TOML
// template. It extends the core SDK template.
func CustomConfigTemplate() string {
config := serverconfig.DefaultConfigTemplate
lines := strings.Split(config, "\n")
// add the Gaia config at the second line of the file
lines[2] += customGaiaConfigTemplate
return strings.Join(lines, "\n")
}

// CustomAppConfig defines Gaia's custom application configuration.
type CustomAppConfig struct {
serverconfig.Config
Expand Down
2 changes: 1 addition & 1 deletion cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func initAppConfig() (string, interface{}) {
srvCfg.StateSync.SnapshotInterval = 1000
srvCfg.StateSync.SnapshotKeepRecent = 10

return params.CustomConfigTemplate, params.CustomAppConfig{
return params.CustomConfigTemplate(), params.CustomAppConfig{
Config: *srvCfg,
BypassMinFeeMsgTypes: []string{
sdk.MsgTypeURL(&ibcchanneltypes.MsgRecvPacket{}),
Expand Down

0 comments on commit d75104c

Please sign in to comment.