From 11572c1a0d2732ee7520e42cce35f239c1b6b040 Mon Sep 17 00:00:00 2001 From: georgelombardi97 <106404363+georgelombardi97@users.noreply.github.com> Date: Wed, 21 Sep 2022 17:10:19 +0430 Subject: [PATCH] change DefaultParams on the host to allow all messages ("*") (#2290) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> (cherry picked from commit 17099fe67b33789043f6ea832d1a5fad6ffc70b2) --- CHANGELOG.md | 1 + modules/apps/27-interchain-accounts/host/types/keys.go | 5 ++++- modules/apps/27-interchain-accounts/host/types/params.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f74629166..cf261511ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#2146](https://github.com/cosmos/ibc-go/pull/2146) ICS27 controller now claims the channel capability passed via ibc core, and passes `nil` to the underlying app callback. The channel capability arg in `SendTx` is now ignored and looked up internally. * (apps/27-interchain-accounts) [\#2177](https://github.com/cosmos/ibc-go/pull/2177) Adding `IsMiddlewareEnabled` flag to interchain accounts `ActiveChannel` genesis type. * (apps/27-interchain-accounts) [\#2140](https://github.com/cosmos/ibc-go/pull/2140) Adding migration handler to ICS27 `controller` submodule to assert ownership of channel capabilities and set middleware enabled flag for existing channels. The ICS27 module consensus version has been bumped from 1 to 2. +* (apps/27-interchain-accounts) [\#2290](https://github.com/cosmos/ibc-go/pull/2290) Changed `DefaultParams` function in `host` submodule to allow all messages by default. Defined a constant named `AllowAllHostMsgs` for `host` module to keep wildcard "*" string which allows all messages. ### Features diff --git a/modules/apps/27-interchain-accounts/host/types/keys.go b/modules/apps/27-interchain-accounts/host/types/keys.go index 7f1a04facb5..7e0ca350d0e 100644 --- a/modules/apps/27-interchain-accounts/host/types/keys.go +++ b/modules/apps/27-interchain-accounts/host/types/keys.go @@ -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 } diff --git a/modules/apps/27-interchain-accounts/host/types/params.go b/modules/apps/27-interchain-accounts/host/types/params.go index 480de05c286..7193e2f373c 100644 --- a/modules/apps/27-interchain-accounts/host/types/params.go +++ b/modules/apps/27-interchain-accounts/host/types/params.go @@ -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