cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.27k stars 3.63k forks source link

Unexpected minimum-gas-prices behavior #3590

Closed mdyring closed 5 years ago

mdyring commented 5 years ago
## Summary of Bug Starting to question my own sanity, but on 0.31.1 I am seeing unexpected behavior with fees, or at least behavior I can't readily explain. _Scenario 1_ 1) minimum-gas-prices = "" 2) gaiacli create-validator without --fees parameter 3) gaiad tells me it `Added good transaction module=mempool tx=2E3867B988135FE25A2713C2D6AF1A467B581B0E13E7537AABC01BA12075B8AF res="&{CheckTx:gas_wanted:200000 gas_used:13492 }" height=10873 total=1` This is as expected. _Scenario 2_ 1) minimum-gas-prices = "" 2) gaiacli create-validator ... --fees 10moun results in `ERROR: {"codespace":"sdk","code":5,"message":"10000000000muon,10000000000photino \u003c 10moun"}` 3) gaiad reports similar error This is not expected. Why would providing fees lead to tx being rejected? _Scenario 3_ 1) minimum-gas-prices = "0.000005moun" 2) gaiacli create-validator without --fees parameter results in `ERROR: {"codespace":"sdk","code":14,"message":"insufficient fees; got: \"\" required: \"1moun\""}` This is as expected. _Scenario 4_ 1) minimum-gas-prices = "0.000005moun" 2) gaiacli create-validator ... --fees 1moun results in `ERROR: {"codespace":"sdk","code":5,"message":"10000000000muon,10000000000photino \u003c 1moun"}` This is unexpected. Previous invocation (Scenario 3) just told me 1moun was needed. ____ #### For Admin Use - [ ] Not duplicate issue - [ ] Appropriate labels applied - [ ] Appropriate contributors tagged - [ ] Contributor assigned/self-assigned
zmanian commented 5 years ago

In the examples above, muon is mispelled.

Possible answer?

alexanderbez commented 5 years ago

I see nothing wrong with the semantics of scenario 2 -- I cannot reproduce this locally.

I see nothing wrong with the semantics of scenario 4 -- you don't have enough funds for the tx; nothing to do with fees it seems.

mdyring commented 5 years ago

In the examples above, muon is mispelled.

Ooops. Must be testnet fatigue setting in. :-)

Using "muon" solved Scenario 4.

Scenario 2 should AFAICS accept any fee token (also --fees 100yada), since minimum-gas-prices is empty. In case it only accepts "well known" denoms, a better error message would be nice, like "unknown coin denom: denom".

@alexanderbez I can reproduce Scenario 2 by commenting out any settings in gaiad.toml (no command line arguments to gaiad either, except --home)

gaiacli tx staking create-validator  --chain-id gaia-11001 --amount 40000000muon  --min-self-delegation 3333  ...  --fees 1yada
Response:
  TxHash: 6A9377069640C9AD0D011654144065745BD3C409E0BC60D8A085149A8342DB75
ERROR: {"codespace":"sdk","code":5,"message":"10000000000muon,10000000000photino \u003c 1yada"}

I guess since the error message contains both muon and photino, they are the only "well known" and accepted denoms. I do wonder where the amounts "10000000000" come from, though.

alexanderbez commented 5 years ago

@mdyring this comes from DeductFees in the ante handler. This is stating that your coins (spendable) < givenFee. In other words, the fee denom you gave exists at a lesser amount in your account.

mdyring commented 5 years ago

Ah, yeah make sense in a way. I have (implicitly) a 0yada balance.

Not a major issue, but think it would be nice to have (post launch perhaps?) a better error message in case of non-existing denoms - just in case of the odd typo.

alexanderbez commented 5 years ago

@mdyring yes I can improve the error message. However, in this case we dont know which case is the result -- do you not have the denom or do you not have enough.

Hyung-bharvest commented 5 years ago

sudo gaiacli tx staking create-validator --address-delegator

--amount 10000000000muon --commission-max-change-rate 1 --commission-max-rate 1 --commission-rate 1 --fees 200000photino --from bharvest --min-self-delegation 100 --moniker bharvest --chain-id gaia-11001 --pubkey $(sudo gaiad tendermint show-validator)

This worked for me

mdyring commented 5 years ago

@mdyring yes I can improve the error message. However, in this case we dont know which case is the result -- do you not have the denom or do you not have enough.

Right, after looking at code I can see it should work, if I tried to pay with "yada" denom coins and I actually had a yada balance.

Closing and thanks for your help @alexanderbez.