Skip to content

Commit

Permalink
change DefaultParams on the host to allow all messages ("*") (#2290) (#…
Browse files Browse the repository at this point in the history
…2356)

* change DefaultParams on the host to allow all messages ("*")

Interchain Accounts are used by controller chains to execute transactions on the host chain. My suggestion is just as normal wallets are allowed to submit any transaction, by default, the host should allow all types of messages to be submitted using the ICAs.

Allowing all messages by default makes more sense regarding the purpose of Interchain Accounts.
Otherwise, it looks like this parameter should be configured to enable Interchain Accounts.

* correct formatting (gofumpt)

correct formatting (gofumpt)

* hold wildcard string in a constant

* add changelog

Co-authored-by: george <>
Co-authored-by: Carlos Rodriguez <[email protected]>
Co-authored-by: colin axnér <[email protected]>
(cherry picked from commit 17099fe)

Co-authored-by: georgelombardi97 <[email protected]>
Co-authored-by: Carlos Rodriguez <[email protected]>
Co-authored-by: Damian Nolan <[email protected]>
  • Loading branch information
4 people authored Sep 26, 2022
1 parent c1113f8 commit ef1adb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion modules/apps/27-interchain-accounts/host/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ const (

// StoreKey is the store key string for the interchain accounts host module
StoreKey = SubModuleName

// AllowAllHostMsgs holds the string key that allows all message types on interchain accounts host module
AllowAllHostMsgs = "*"
)

// ContainsMsgType returns true if the sdk.Msg TypeURL is present in allowMsgs, otherwise false
func ContainsMsgType(allowMsgs []string, msg sdk.Msg) bool {
// check that wildcard * option for allowing all message types is the only string in the array, if so, return true
if len(allowMsgs) == 1 && allowMsgs[0] == "*" {
if len(allowMsgs) == 1 && allowMsgs[0] == AllowAllHostMsgs {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/host/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewParams(enableHost bool, allowMsgs []string) Params {

// DefaultParams is the default parameter configuration for the host submodule
func DefaultParams() Params {
return NewParams(DefaultHostEnabled, nil)
return NewParams(DefaultHostEnabled, []string{AllowAllHostMsgs})
}

// Validate validates all host submodule parameters
Expand Down

0 comments on commit ef1adb8

Please sign in to comment.