forked from CosmosContracts/juno
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ICA Genesis State x Docker builds x Wasmd 0.29-rc1 (CosmosContracts#297)
* hotfix: wasmvm 1.0.0 -> 1.1.0 * hotfix: update shasums * hotfix: enable cosmwasm_1_1 in app.go * Add genica command to instantiate default ICA params, and add that to docker build * wasmd 0.29.0-rc0 -> 0.29.0-rc1 * chore: tidy * tooling: Dockerfile libwasm 1.1.0 -> 1.1.1 * ci: update to new refs that account for changes in rc * chore: add ICA changes from v10 * chore: also update compose file * chore: update ICA allowed messages to match v10.0.2 * fix: multisend isn't actually in v10.0.2, msgvoteweighted is * feat: separate upgrade handlers out so they remain documented * chore: add instantiate2 msg to match wasmd 0.29 * chore: add placeholders for messages that will be added in v11 * chore: shut up the pendantic linter * ci: remove superlinter as it adds no value * deps: wasmd 0.29.0-rc1 -> rc2
- Loading branch information
Showing
20 changed files
with
229 additions
and
48 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
|
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: Build Docker Image on PR | ||
|
||
on: | ||
|
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: golangci-lint | ||
on: | ||
push: | ||
|
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
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: release binary | ||
|
||
on: | ||
|
This file was deleted.
Oops, something went wrong.
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
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
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,100 @@ | ||
package upgrades | ||
|
||
import ( | ||
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
"github.com/cosmos/cosmos-sdk/x/authz" | ||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" | ||
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" | ||
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" | ||
|
||
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" | ||
) | ||
|
||
// CreateV10UpgradeHandler makes an upgrade handler for v11 of Juno | ||
func CreateV10UpgradeHandler(mm *module.Manager, cfg module.Configurator, icahostkeeper *icahostkeeper.Keeper) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
|
||
// update ICA Host to catch missed msg | ||
// enumerate all because it's easier to reason about | ||
newIcaHostParams := icahosttypes.Params{ | ||
HostEnabled: true, | ||
AllowMessages: []string{ | ||
sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}), // missed but asked for | ||
|
||
sdk.MsgTypeURL(&banktypes.MsgSend{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}), // this was missed last time | ||
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}), | ||
sdk.MsgTypeURL(&govtypes.MsgVote{}), | ||
sdk.MsgTypeURL(&govtypes.MsgVoteWeighted{}), // required by quick | ||
sdk.MsgTypeURL(&authz.MsgExec{}), | ||
sdk.MsgTypeURL(&authz.MsgGrant{}), | ||
sdk.MsgTypeURL(&authz.MsgRevoke{}), | ||
// wasm msgs here | ||
// note we only support these three for now | ||
sdk.MsgTypeURL(&wasmtypes.MsgStoreCode{}), | ||
sdk.MsgTypeURL(&wasmtypes.MsgInstantiateContract{}), | ||
sdk.MsgTypeURL(&wasmtypes.MsgExecuteContract{}), | ||
}, | ||
} | ||
icahostkeeper.SetParams(ctx, newIcaHostParams) | ||
|
||
// mint module consensus version bumped | ||
return mm.RunMigrations(ctx, cfg, vm) | ||
|
||
} | ||
} | ||
|
||
// CreateV11UpgradeHandler makes an upgrade handler for v11 of Juno | ||
func CreateV11UpgradeHandler(mm *module.Manager, cfg module.Configurator, icahostkeeper *icahostkeeper.Keeper) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
|
||
// update ICA Host to add new messages available | ||
// enumerate all because it's easier to reason about | ||
newIcaHostParams := icahosttypes.Params{ | ||
HostEnabled: true, | ||
AllowMessages: []string{ | ||
sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}), // added in v10 | ||
|
||
sdk.MsgTypeURL(&banktypes.MsgSend{}), | ||
sdk.MsgTypeURL(&banktypes.MsgMultiSend{}), // this was missed last time | ||
sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}), // added in v10 | ||
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}), | ||
sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}), | ||
sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}), | ||
sdk.MsgTypeURL(&govtypes.MsgVote{}), | ||
sdk.MsgTypeURL(&govtypes.MsgVoteWeighted{}), // added in v10 | ||
sdk.MsgTypeURL(&authz.MsgExec{}), | ||
sdk.MsgTypeURL(&authz.MsgGrant{}), | ||
sdk.MsgTypeURL(&authz.MsgRevoke{}), | ||
// wasm msgs here | ||
// note we only support three atm | ||
sdk.MsgTypeURL(&wasmtypes.MsgStoreCode{}), | ||
sdk.MsgTypeURL(&wasmtypes.MsgInstantiateContract{}), | ||
sdk.MsgTypeURL(&wasmtypes.MsgInstantiateContract2{}), // added in wasmd 0.29.0 | ||
sdk.MsgTypeURL(&wasmtypes.MsgExecuteContract{}), | ||
}, | ||
} | ||
icahostkeeper.SetParams(ctx, newIcaHostParams) | ||
|
||
return mm.RunMigrations(ctx, cfg, vm) | ||
|
||
} | ||
} |
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,99 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"github.com/spf13/cobra" | ||
|
||
icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" | ||
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" | ||
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/server" | ||
"github.com/cosmos/cosmos-sdk/x/genutil" | ||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" | ||
) | ||
|
||
// AddGenesisAccountCmd returns add-genesis-account cobra Command. | ||
func AddGenesisIcaCmd(defaultNodeHome string) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "add-ica-config", | ||
Short: "Add ICA config to genesis.json", | ||
Long: `Add default ICA configuration to genesis.json`, | ||
Args: cobra.ExactArgs(0), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
clientCtx := client.GetClientContextFromCmd(cmd) | ||
serverCtx := server.GetServerContextFromCmd(cmd) | ||
config := serverCtx.Config | ||
|
||
config.SetRoot(clientCtx.HomeDir) | ||
|
||
genFile := config.GenesisFile() | ||
appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) | ||
if err != nil { | ||
return fmt.Errorf("failed to unmarshal genesis state: %w", err) | ||
} | ||
|
||
controllerGenesisState := icatypes.DefaultControllerGenesis() | ||
// no params set in upgrade handler, no params set here | ||
controllerGenesisState.Params = icacontrollertypes.Params{} | ||
|
||
hostGenesisState := icatypes.DefaultHostGenesis() | ||
// add the messages we want | ||
hostGenesisState.Params = icahosttypes.Params{ | ||
HostEnabled: true, | ||
AllowMessages: []string{ | ||
"/cosmos.bank.v1beta1.MsgSend", | ||
// uncomment this after v11 ships | ||
// "/cosmos.bank.v1beta1.MsgMultiSend", | ||
"/cosmos.staking.v1beta1.MsgDelegate", | ||
"/cosmos.staking.v1beta1.MsgUndelegate", | ||
"/cosmos.staking.v1beta1.MsgBeginRedelegate", | ||
"/cosmos.staking.v1beta1.MsgCreateValidator", | ||
"/cosmos.staking.v1beta1.MsgEditValidator", | ||
"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", | ||
"/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", | ||
"/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", | ||
"/cosmos.distribution.v1beta1.MsgFundCommunityPool", | ||
"/cosmos.gov.v1beta1.MsgVote", | ||
"/cosmos.gov.v1beta1.MsgVoteWeighted", | ||
"/cosmos.authz.v1beta1.MsgExec", | ||
"/cosmos.authz.v1beta1.MsgGrant", | ||
"/cosmos.authz.v1beta1.MsgRevoke", | ||
"/cosmwasm.wasm.v1.MsgStoreCode", | ||
"/cosmwasm.wasm.v1.MsgInstantiateContract", | ||
// uncomment this after v11 ships | ||
// "/cosmwasm.wasm.v1.InstantiateContract2", | ||
"/cosmwasm.wasm.v1.MsgExecuteContract", | ||
"/ibc.applications.transfer.v1.MsgTransfer", | ||
}, | ||
} | ||
|
||
newIcaGenState := icatypes.NewGenesisState(controllerGenesisState, hostGenesisState) | ||
|
||
icaGenStateBz, err := clientCtx.Codec.MarshalJSON(newIcaGenState) | ||
if err != nil { | ||
return fmt.Errorf("failed to marshal auth genesis state: %w", err) | ||
} | ||
|
||
appState[icatypes.ModuleName] = icaGenStateBz | ||
|
||
appStateJSON, err := json.Marshal(appState) | ||
if err != nil { | ||
return fmt.Errorf("failed to marshal application genesis state: %w", err) | ||
} | ||
|
||
genDoc.AppState = appStateJSON | ||
return genutil.ExportGenesisFile(genDoc, genFile) | ||
}, | ||
} | ||
|
||
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") | ||
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") | ||
|
||
flags.AddQueryFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
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
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
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
Oops, something went wrong.