Cosmos-sdk: --generate-only broke between v0.33 and v0.34

Created on 16 Apr 2019  路  7Comments  路  Source: cosmos/cosmos-sdk

Summary of Bug

gaiacli txs work without the "--generate-only" flag but fail with the "--generate-only" flag yeilding failed to get from fields: decoding bech32 failed: invalid bech32 string length 4.

Example of a successful execution:

[dave@debt hugnet]$ gaiacli tx staking delegate cosmosvaloper1rcp29q3hpd246n6qak7jluqep4v006cdsc2kkl 1000000muon --from debt --chain-id gaia-13003 --gas auto --gas-adjustment 1.1 --fees 2000muon
gas estimate: 102328
{"chain_id":"gaia-13003","account_number":"79","sequence":"102","fee":{"amount":[{"denom":"muon","amount":"2000"}],"gas":"102328"},"msgs":[{"type":"cosmos-sdk/MsgDelegate","value":{"delegator_address":"cosmos1zkupr83hrzkn3up5elktzcq3tuft8nxs76e4yj","validator_address":"cosmosvaloper1rcp29q3hpd246n6qak7jluqep4v006cdsc2kkl","amount":{"denom":"muon","amount":"1000000"}}}],"memo":""}

confirm transaction before signing and broadcasting [Y/n]: y
Password to sign with 'debt':
Response:
  TxHash: CF27CC8C4BEE2A5BFED6057F9615F1480F02E267D5361EFE8C215EA9D8B7A89D

Example of a failed execution with the only difference in the command being the "--generate-only" flag:

[dave@debt hugnet]$ gaiacli tx staking delegate cosmosvaloper1rcp29q3hpd246n6qak7jluqep4v006cdsc2kkl 1000000muon --from debt --chain-id gaia-13003 --gas auto --gas-adjustment 1.1 --fees 2000muon --generate-only
failed to get from fields: decoding bech32 failed: invalid bech32 string length 4[dave@debt hugnet]$ 

Version

[dave@debt us]$ gaiad version --long
cosmos-sdk: 0.34.0
git commit: 0f7877c23b407e24e56056469e90fe6b8a78d84c
vendor hash: b0ee613acca9a3a572b558d0481ec7baa008f732431392af81db3555c92c8dd7
build tags: netgo ledger
go version go1.11.5 linux/amd64

[dave@debt us]$ gaiacli version --long
cosmos-sdk: 0.34.0
git commit: 0f7877c23b407e24e56056469e90fe6b8a78d84c
vendor hash: b0ee613acca9a3a572b558d0481ec7baa008f732431392af81db3555c92c8dd7
build tags: netgo ledger
go version go1.11.5 linux/amd64
[dave@debt us]$ 

Steps to Reproduce

Added the "--generate-only" flag to a gaiacli command.


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

Most helpful comment

gaiacli tx staking delegate cosmosvaloper1rcp29q3hpd246n6qak7jluqep4v006cdsc2kkl 1000000muon --from `gaiacli keys show --address debt` --chain-id gaia-13003 --gas auto --gas-adjustment 1.1 --fees 2000muon --generate-only

Thank-you for the quick response and the workaround, I can live with it.

I agree with the goal of consistency.

BTW, I did search for various forms of "generate-only" before submitting the issue. #3960 never came up. Regardless, I owe @alessio a beer!

All 7 comments

I can reproduce

https://github.com/cosmos/cosmos-sdk/commit/90797f5e09f980276e0fa609c3f5d1e9fbd6e335

It's a longstanding problem. We've made confusion between --generate-only and --offline. I think it's right about the time to come up with a better design of the two modes, see https://github.com/cosmos/cosmos-sdk/issues/3720#issuecomment-469184264

@davepuchyr All I can do for now is tentatively recommending a mitigation to your problem. Try the following:

gaiacli tx staking delegate cosmosvaloper1rcp29q3hpd246n6qak7jluqep4v006cdsc2kkl 1000000muon --from `gaiacli keys show --address debt` --chain-id gaia-13003 --gas auto --gas-adjustment 1.1 --fees 2000muon --generate-only

Thanks @davepuchyr, but this is not a bug and is intended behavior, see: https://github.com/cosmos/cosmos-sdk/pull/3960. The goal was to have generate-only functionality be consistent across clients, both REST and CLI.

You must provide a valid Bech32 cosmos address as input whenever performing generate-only. If you deem that it should not be consistent across both clients, please open another issue to allow further discourse.

gaiacli tx staking delegate cosmosvaloper1rcp29q3hpd246n6qak7jluqep4v006cdsc2kkl 1000000muon --from `gaiacli keys show --address debt` --chain-id gaia-13003 --gas auto --gas-adjustment 1.1 --fees 2000muon --generate-only

Thank-you for the quick response and the workaround, I can live with it.

I agree with the goal of consistency.

BTW, I did search for various forms of "generate-only" before submitting the issue. #3960 never came up. Regardless, I owe @alessio a beer!

Thanks @davepuchyr. A valid search came up for me with query: "generate" :)

Enjoy your 馃嵒

There is a similar in #6434

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rigelrozanski picture rigelrozanski  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

ValarDragon picture ValarDragon  路  3Comments

kevlubkcm picture kevlubkcm  路  3Comments