ignite / cli

Ignite is a CLI tool and hub designed for constructing Proof of Stake Blockchains rooted in Cosmos-SDK
https://ignite.com
Other
1.25k stars 550 forks source link

Starport doesn't generate the code for Update IBC clients by governance #1813

Closed RaulBernal closed 2 years ago

RaulBernal commented 2 years ago

Describe the bug When you want to send a governance proposal to Update a frozen IBC client, you can't find the command:

bcnad tx gov  submit-proposal 
Error: invalid message: can't proto marshal <nil>
Usage:
  bcnad tx gov submit-proposal [flags]
  bcnad tx gov submit-proposal [command]

Available Commands:
  cancel-software-upgrade Cancel the current software upgrade proposal
  community-pool-spend    Submit a community pool spend proposal
  param-change            Submit a parameter change proposal
  software-upgrade        Submit a software upgrade proposal

It should include a update-client <expired-client-id> <active-client-id> params

To Reproduce Steps to reproduce the behavior:

  1. bcnad tx gov submit-proposal update-client

Please provide the version output

jhernandezb commented 2 years ago

it seems like the router key is also misconfigured in app.go and would be a breaking change for chains

Should be AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))

See migration guide https://github.com/cosmos/ibc-go/blob/main/docs/migrations/sdk-to-v1.md#proposal-handler-registration

RaulBernal commented 2 years ago

Hi! I have applied the changes and it show the option now :)

$ bcna2d tx gov submit-proposal 
Error: invalid message: can't proto marshal <nil>
Usage:
  bcna2d tx gov submit-proposal [flags]
  bcna2d tx gov submit-proposal [command]

Available Commands:
  cancel-software-upgrade Cancel the current software upgrade proposal
  community-pool-spend    Submit a community pool spend proposal
  ibc-upgrade             Submit an IBC upgrade proposal
  param-change            Submit a parameter change proposal
  software-upgrade        Submit a software upgrade proposal
  update-client           Submit an update IBC client proposal

I didn't test the update-client yet but I will.

bcna2d tx gov submit-proposal update-client 
Error: accepts 3 arg(s), received 0
Usage:
  bcna2d tx gov submit-proposal update-client [subject-client-id] [substitute-client-id] [flags]

Flags:
  -a, --account-number uint      The account number of the signing account (offline mode only)
  -b, --broadcast-mode string    Transaction broadcasting mode (sync|async|block) (default "sync")
      --deposit string           deposit of proposal
[............]

BTW see the error in the output: Error: invalid message: can't proto marshal <nil>

RaulBernal commented 2 years ago

BTW testing the command I found this error msg:

$ bcnad tx gov submit-proposal update-client 07-tendermint-01 07-tendermint-02 --from alice --title "uprade IBC client"  --deposit 1000000ubcna --description "testing update of IBC Client" --fees 1000ubcna --deposit 100000ubcna --chain-id bitcanna-dev-1 
Error: accepts 3 arg(s), received 2
Usage:
  bcnad tx gov submit-proposal update-client [subject-client-id] [substitute-client-id] [flags]
RaulBernal commented 2 years ago

Should be AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))

Osmosis, in their last update has added the route and modified the old ibchost. AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).

    AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
jhernandezb commented 2 years ago

Seems like osmosis actually have it duplicated but the official guide says that it should be replaced with ibcclienttypes.RouterKey I guess someone should write an integration test to recover an expired client 😬

RaulBernal commented 2 years ago

I guessed it, but take in consideration that I tested a proposal making the indicated changes in code and it doesn't works

El mié., 15 dic. 2021 20:28, Jorge Hernandez @.***> escribió:

Seems like osmosis actually have it duplicated but the official guide says that it should be replaced with ibcclienttypes.RouterKey I guess someone should write an integration test to recover an expired client 😬

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tendermint/starport/issues/1813#issuecomment-995129003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4T75QTVZV57DAIW7MKNXDURDT45ANCNFSM5IBHQ6XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jhernandezb commented 2 years ago

Going to give it a try and report back

RaulBernal commented 2 years ago

Hello :) I've update to ibc-go/v2 , SDK v.0.44.5 and Tendermint v.34.15

name: bcna
server_name: bcnad
version: 1.3-pre3
commit: f1a10f6b347afa7ace5e3cf6f35a9bd89092c896
build_tags: netgo,ledger
go: go version go1.17.5 linux/amd64
build_deps:
- filippo.io/edwards25519@v1.0.0-beta.2
- github.com/99designs/keyring@v1.1.6
- github.com/ChainSafe/go-schnorrkel@v0.0.0-20200405005733-88cbf1b4c40d
- github.com/Workiva/go-datastructures@v1.0.53
- github.com/armon/go-metrics@v0.3.9
- github.com/beorn7/perks@v1.0.1
- github.com/bgentry/speakeasy@v0.1.0
- github.com/btcsuite/btcd@v0.22.0-beta
- github.com/cespare/xxhash/v2@v2.1.2
- github.com/coinbase/rosetta-sdk-go@v0.6.10
- github.com/confio/ics23/go@v0.6.6
- github.com/cosmos/btcutil@v1.0.4
- github.com/cosmos/cosmos-sdk@v0.44.5
- github.com/cosmos/go-bip39@v1.0.0
- github.com/cosmos/iavl@v0.17.3
- github.com/cosmos/ibc-go/v2@v2.0.2
- github.com/cosmos/ledger-cosmos-go@v0.11.1
- github.com/cosmos/ledger-go@v0.9.2
- github.com/davecgh/go-spew@v1.1.1
- github.com/desertbit/timer@v0.0.0-20180107155436-c41aec40b27f
- github.com/dvsekhvalnov/jose2go@v0.0.0-20200901110807-248326c1351b
- github.com/felixge/httpsnoop@v1.0.1
- github.com/fsnotify/fsnotify@v1.5.1
- github.com/go-kit/kit@v0.12.0
- github.com/go-kit/log@v0.2.0
- github.com/go-logfmt/logfmt@v0.5.1
- github.com/godbus/dbus@v0.0.0-20190726142602-4481cbc300e2
- github.com/gogo/gateway@v1.1.0
- github.com/gogo/protobuf@v1.3.3 => github.com/regen-network/protobuf@v1.3.3-alpha.regen.1
- github.com/golang/protobuf@v1.5.2
- github.com/golang/snappy@v0.0.3
- github.com/google/btree@v1.0.0
- github.com/google/orderedcode@v0.0.1
- github.com/gorilla/handlers@v1.5.1
- github.com/gorilla/mux@v1.8.0
- github.com/gorilla/websocket@v1.4.2
- github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0
- github.com/grpc-ecosystem/grpc-gateway@v1.16.0
- github.com/gsterjov/go-libsecret@v0.0.0-20161001094733-a6f4afe4910c
- github.com/gtank/merlin@v0.1.1
- github.com/gtank/ristretto255@v0.1.2
- github.com/hashicorp/go-immutable-radix@v1.3.1
- github.com/hashicorp/golang-lru@v0.5.4
- github.com/hashicorp/hcl@v1.0.0
- github.com/hdevalence/ed25519consensus@v0.0.0-20210204194344-59a8610d2b87
- github.com/improbable-eng/grpc-web@v0.14.1
- github.com/klauspost/compress@v1.13.6
- github.com/lib/pq@v1.10.4
- github.com/libp2p/go-buffer-pool@v0.0.2
- github.com/magiconair/properties@v1.8.5
- github.com/mattn/go-isatty@v0.0.14
- github.com/matttproud/golang_protobuf_extensions@v1.0.1
- github.com/mimoo/StrobeGo@v0.0.0-20181016162300-f8f6d4d2b643
- github.com/minio/highwayhash@v1.0.2
- github.com/mitchellh/go-homedir@v1.1.0
- github.com/mitchellh/mapstructure@v1.4.2
- github.com/mtibben/percent@v0.2.1
- github.com/pelletier/go-toml@v1.9.4
- github.com/pkg/errors@v0.9.1
- github.com/pmezard/go-difflib@v1.0.0
- github.com/prometheus/client_golang@v1.11.0
- github.com/prometheus/client_model@v0.2.0
- github.com/prometheus/common@v0.30.0
- github.com/prometheus/procfs@v0.7.3
- github.com/rakyll/statik@v0.1.7
- github.com/rcrowley/go-metrics@v0.0.0-20200313005456-10cdbea86bc0
- github.com/regen-network/cosmos-proto@v0.3.1
- github.com/rs/cors@v1.8.0
- github.com/rs/zerolog@v1.23.0
- github.com/spf13/afero@v1.6.0
- github.com/spf13/cast@v1.4.1
- github.com/spf13/cobra@v1.2.1
- github.com/spf13/jwalterweatherman@v1.1.0
- github.com/spf13/pflag@v1.0.5
- github.com/spf13/viper@v1.9.0
- github.com/stretchr/testify@v1.7.0
- github.com/subosito/gotenv@v1.2.0
- github.com/syndtr/goleveldb@v1.0.1-0.20200815110645-5c35d600f0ca
- github.com/tendermint/btcd@v0.1.1
- github.com/tendermint/crypto@v0.0.0-20191022145703-50d29ede1e15
- github.com/tendermint/go-amino@v0.16.0
- github.com/tendermint/spm@v0.1.8 => github.com/RaulBernal/spm@v0.1.9-ibc2
- github.com/tendermint/tendermint@v0.34.15
- github.com/tendermint/tm-db@v0.6.6
- github.com/zondax/hid@v0.9.0
- golang.org/x/crypto@v0.0.0-20210915214749-c084706c2272
- golang.org/x/net@v0.0.0-20211005001312-d4b1ae081e3b
- golang.org/x/sys@v0.0.0-20211004093028-2c5d950f24ef
- golang.org/x/term@v0.0.0-20201126162022-7de9c90e9dd1
- golang.org/x/text@v0.3.7
- google.golang.org/genproto@v0.0.0-20211208223120-3a66f561d7aa
- google.golang.org/grpc@v1.43.0 => google.golang.org/grpc@v1.33.2
- google.golang.org/protobuf@v1.27.1
- gopkg.in/ini.v1@v1.63.2
- gopkg.in/yaml.v2@v2.4.0
- gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b
- nhooyr.io/websocket@v1.8.6
cosmos_sdk_version: v0.44.5

Now I can send the proposal but a new issue raises:

build/bcnad tx gov submit-proposal update-client 07-tendermint-01 07-tendermint-02 --from validator --title "uprade IBC client"  --deposit 1000000ubcna --description "testing update of IBC Client" --fees 1000ubcna --deposit 100000ubcna --chain-id bitcanna-dev-1
Enter keyring passphrase:
{"body":{"messages":[{"@type":"/cosmos.gov.v1beta1.MsgSubmitProposal","content":{"@type":"/ibc.core.client.v1.ClientUpdateProposal","title":"uprade IBC client","description":"testing update of IBC Client","subject_client_id":"07-tendermint-01","substitute_client_id":"07-tendermint-02"},"initial_deposit":[{"denom":"ubcna","amount":"100000"}],"proposer":"bcna1kqjfuakxwmjpgr7psw66z6pd7xq6l0w7mn6k7a"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"ubcna","amount":"1000"}],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 7FD93E1AB21B82F65D21BBA099B3DEF6CE3D33432B4B8D9F0DB0F509ECBD2F27 

If I query the TX, the proposal is not generated:

build/bcnad query tx 41F58F447941608A3FB55147A2B00B9FB465F48932762344A94DB4738B30D5A2
code: 9
codespace: gov
data: ""
events: []
gas_used: "50511"
gas_wanted: "200000"
height: "1312749"
info: ""
logs: []
raw_log: 'failed to execute message; message index: 0: client: no handler exists for
  proposal type'
timestamp: "2021-12-28T10:40:28Z"
tx:
  '@type': /cosmos.tx.v1beta1.Tx
  auth_info:
    fee:
      amount:
      - amount: "1000"
        denom: ubcna
      gas_limit: "200000"
      granter: ""
      payer: ""
    signer_infos:
    - mode_info:
        single:
          mode: SIGN_MODE_DIRECT
      public_key:
        '@type': /cosmos.crypto.secp256k1.PubKey
        key: ArZiMlzonNQSzLwAojwe2LLfkpbeSvvzAPuhRu9ozpVD
      sequence: "20"
  body:
    extension_options: []
    memo: ""
    messages:
    - '@type': /cosmos.gov.v1beta1.MsgSubmitProposal
      content:
        '@type': /ibc.core.client.v1.ClientUpdateProposal
        description: testing update of IBC Client
        subject_client_id: 07-tendermint-1
        substitute_client_id: 07-tendermint-2
        title: uprade IBC client
      initial_deposit:
      - amount: "100000"
        denom: ubcna
      proposer: bcna1kqjfuakxwmjpgr7psw66z6pd7xq6l0w7mn6k7a
    non_critical_extension_options: []
    timeout_height: "0"
  signatures:
  - S8JZ95V7nI8/p+ZYJMbD2QebThrQMln1sPFeJAQGKG0OQZK9yKUvTMP1XjNfNuA8MfuL+daslDPQeZXGzvbifw==
txhash: 41F58F447941608A3FB55147A2B00B9FB465F48932762344A94DB4738B30D5A2