-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8eed669
commit 71f34e7
Showing
1 changed file
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package params | ||
|
||
import ( | ||
"strings" | ||
|
||
serverconfig "github.com/cosmos/cosmos-sdk/server/config" | ||
) | ||
|
||
var ( | ||
// BypassMinFeeMsgTypesKey defines the configuration key for the | ||
// BypassMinFeeMsgTypes value. | ||
//nolint: gosec | ||
BypassMinFeeMsgTypesKey = "bypass-min-fee-msg-types" | ||
|
||
// customMigalooConfigTemplate defines Migaloo's custom application configuration TOML template. | ||
customMigalooConfigTemplate = ` | ||
############################################################################### | ||
### Custom Migaloo Configuration ### | ||
############################################################################### | ||
# bypass-min-fee-msg-types defines custom message types the operator may set that | ||
# will bypass minimum fee checks during CheckTx. | ||
# NOTE: | ||
# bypass-min-fee-msg-types = [] will deactivate the bypass - no messages will be allowed to bypass the minimum fee check | ||
# bypass-min-fee-msg-types = [<MsgType>...] will allow messages of specified type to bypass the minimum fee check | ||
# removing bypass-min-fee-msg-types from the config file will apply the default values: | ||
# ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", "/ibc.core.client.v1.MsgUpdateClient"] | ||
# | ||
# Example: | ||
# bypass-min-fee-msg-types = ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", "/ibc.core.client.v1.MsgUpdateClient"] | ||
bypass-min-fee-msg-types = [{{ range .BypassMinFeeMsgTypes }}{{ printf "%q, " . }}{{end}}] | ||
` | ||
) | ||
|
||
// CustomConfigTemplate defines Migaloo'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 Migaloo config at the second line of the file | ||
lines[2] += customMigalooConfigTemplate | ||
return strings.Join(lines, "\n") | ||
} | ||
|
||
// CustomAppConfig defines Migaloo's custom application configuration. | ||
type CustomAppConfig struct { | ||
serverconfig.Config | ||
|
||
// BypassMinFeeMsgTypes defines custom message types the operator may set that | ||
// will bypass minimum fee checks during CheckTx. | ||
// NOTE: | ||
// bypass-min-fee-msg-types = [] will deactivate the bypass - no messages will be allowed to bypass the minimum fee check | ||
// bypass-min-fee-msg-types = [<some_msg_type>] will allow messages of specified type to bypass the minimum fee check | ||
// omitting bypass-min-fee-msg-types from the config file will use the default values: ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", "/ibc.core.client.v1.MsgUpdateClient"] | ||
BypassMinFeeMsgTypes []string `mapstructure:"bypass-min-fee-msg-types"` | ||
} |