Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cosmos/ibc-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: notional-labs/ibc-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: kien/expose-migrate-contract-entry-point
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 10 commits
  • 4 files changed
  • 3 contributors

Commits on Apr 28, 2024

  1. feat: expose migrate entry point for 08-wasm

    duvbell committed Apr 28, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    duvbell duvbell
    Copy the full SHA
    b29c96a View commit details
  2. add CLI documentation

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    866d6dd View commit details
  3. add changelog

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    7e98cb7 View commit details
  4. improve CLI inline docs

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    9d4a6d2 View commit details
  5. small fix

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    2d74aaa View commit details
  6. rename variable

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    204b40e View commit details
  7. remove gov flags

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    b6515af View commit details
  8. use double quotes

    crodriguezvega committed Apr 28, 2024
    Copy the full SHA
    4b7eee7 View commit details

Commits on Apr 29, 2024

  1. fix lint warning

    crodriguezvega committed Apr 29, 2024
    Copy the full SHA
    0e7b454 View commit details
  2. Apply suggestions from code review

    Co-authored-by: Damian Nolan <[email protected]>
    crodriguezvega and damiannolan authored Apr 29, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    77b3f6c View commit details
10 changes: 10 additions & 0 deletions docs/docs/03-light-clients/04-wasm/08-client.md
Original file line number Diff line number Diff line change
@@ -29,6 +29,16 @@ simd tx ibc-wasm store-code [path/to/wasm-file] [flags]

`path/to/wasm-file` is the path to the `.wasm` or `.wasm.gz` file.

#### `migrate-contract`

The `migrate-contract` command allows users to broadcast a transaction with a `MsgMigrateContract` to migrate the contract for a given light client to a new byte code denoted by the given checksum.

```shell
simd tx ibc-wasm migrate-contract [client-id] [checksum] [migrate-msg]
```

The migrate message must not be emptied and is expected to be a JSON-encoded string.

### Query

The `query` commands allow users to query `08-wasm` state.
1 change: 1 addition & 0 deletions modules/light-clients/08-wasm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features

* [#\5821](https://github.com/cosmos/ibc-go/pull/5821) feat: add `VerifyMembershipProof` RPC query (querier approach for conditional clients).
* [#\6231](https://github.com/cosmos/ibc-go/pull/6231) feat: add CLI to broadcast transaction with `MsgMigrateContract`.

### Bug Fixes

1 change: 1 addition & 0 deletions modules/light-clients/08-wasm/client/cli/cli.go
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ func NewTxCmd() *cobra.Command {

txCmd.AddCommand(
newSubmitStoreCodeProposalCmd(),
newMigrateContractCmd(),
)

return txCmd
40 changes: 39 additions & 1 deletion modules/light-clients/08-wasm/client/cli/tx.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ func newSubmitStoreCodeProposalCmd() *cobra.Command {
Use: "store-code [path/to/wasm-file]",
Short: "Reads wasm code from the file and creates a proposal to store the wasm code",
Long: "Reads wasm code from the file and creates a proposal to store the wasm code",
Example: fmt.Sprintf("%s tx %s wasm [path/to/wasm_file]", version.AppName, ibcexported.ModuleName),
Example: fmt.Sprintf("%s tx %s-wasm store-code [path/to/wasm_file]", version.AppName, ibcexported.ModuleName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
@@ -82,3 +82,41 @@ func newSubmitStoreCodeProposalCmd() *cobra.Command {

return cmd
}

func newMigrateContractCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "migrate-contract [client-id] [checksum] [migrate-msg]",
Short: "Migrates a contract to a new byte code",
Long: "Migrates the contract for the specified client ID to the byte code corresponding to checksum, passing the JSON-encoded migrate message to the contract",
Example: fmt.Sprintf("%s tx %s-wasm migrate-contract 08-wasm-0 b3a49b2914f5e6a673215e74325c1d153bb6776e079774e52c5b7e674d9ad3ab {}", version.AppName, ibcexported.ModuleName),
Args: cobra.ExactArgs(3), // Ensure exactly three arguments are passed
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

clientID := args[0]
checksum := args[1]
migrateMsg := args[2]

// Construct the message
msg := &types.MsgMigrateContract{
Signer: clientCtx.GetFromAddress().String(),
ClientId: clientID,
Checksum: []byte(checksum),
Msg: []byte(migrateMsg),
}

if err := msg.ValidateBasic(); err != nil {
return err
}

// Generate or broadcast the transaction
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)
return cmd
}