diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index f65feda17e5..0a247698996 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -10,7 +10,8 @@ import ( "github.com/osmosis-labs/osmosis/v15/app/keepers" "github.com/osmosis-labs/osmosis/v15/app/upgrades" - distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + cosmwasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" cltypes "github.com/osmosis-labs/osmosis/v15/x/concentrated-liquidity/types" superfluidtypes "github.com/osmosis-labs/osmosis/v15/x/superfluid/types" @@ -77,6 +78,27 @@ func CreateUpgradeHandler( return nil, err } + // Add both MsgExecuteContract and MsgInstantiateContract to the list of allowed messages. + hostParams := keepers.ICAHostKeeper.GetParams(ctx) + msgExecuteContractExists := false + msgInstantiateContractExists := false + for _, msg := range hostParams.AllowMessages { + if msg == sdk.MsgTypeURL(&cosmwasmtypes.MsgExecuteContract{}) { + msgExecuteContractExists = true + } + if msg == sdk.MsgTypeURL(&cosmwasmtypes.MsgInstantiateContract{}) { + msgInstantiateContractExists = true + } + } + if !msgExecuteContractExists { + hostParams.AllowMessages = append(hostParams.AllowMessages, sdk.MsgTypeURL(&cosmwasmtypes.MsgExecuteContract{})) + } + + if !msgInstantiateContractExists { + hostParams.AllowMessages = append(hostParams.AllowMessages, sdk.MsgTypeURL(&cosmwasmtypes.MsgInstantiateContract{})) + } + keepers.ICAHostKeeper.SetParams(ctx, hostParams) + // Although parameters are set on InitGenesis() in RunMigrations(), we reset them here // for visibility of the final configuration. defaultConcentratedLiquidityParams := keepers.ConcentratedLiquidityKeeper.GetParams(ctx) @@ -98,7 +120,7 @@ func CreateUpgradeHandler( // Create a position to initialize the balancerPool. // Get community pool and DAI/OSMO pool address. - communityPoolAddress := keepers.AccountKeeper.GetModuleAddress(distributiontypes.ModuleName) + communityPoolAddress := keepers.AccountKeeper.GetModuleAddress(distrtypes.ModuleName) daiOsmoPool, err := keepers.PoolManagerKeeper.GetPool(ctx, DaiOsmoPoolId) if err != nil { return nil, err diff --git a/app/upgrades/v16/upgrades_test.go b/app/upgrades/v16/upgrades_test.go index fa87d49052d..c95f22a5d3b 100644 --- a/app/upgrades/v16/upgrades_test.go +++ b/app/upgrades/v16/upgrades_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + cosmwasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -123,6 +124,11 @@ func (suite *UpgradeTestSuite) TestUpgrade() { // Ensure that the protorev upgrade was successful verifyProtorevUpdateSuccess(suite) + + // Validate MsgExecuteContract and MsgInstantiateContract were added to the whitelist + icaHostAllowList := suite.App.ICAHostKeeper.GetParams(suite.Ctx) + suite.Require().Contains(icaHostAllowList.AllowMessages, sdk.MsgTypeURL(&cosmwasmtypes.MsgExecuteContract{})) + suite.Require().Contains(icaHostAllowList.AllowMessages, sdk.MsgTypeURL(&cosmwasmtypes.MsgInstantiateContract{})) }, func() { // Validate that tokenfactory params have been updated