Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero gas transactions cause incorrect error #10177

Closed
4 tasks
mvid opened this issue Sep 16, 2021 · 10 comments
Closed
4 tasks

Zero gas transactions cause incorrect error #10177

mvid opened this issue Sep 16, 2021 · 10 comments

Comments

@mvid
Copy link
Contributor

mvid commented Sep 16, 2021

Summary of Bug

When submitting a tx without the gas value set, the AnteHandle function incorrectly multiplies the gas limit by the gas fee, resulting in an error message like this:

insufficient fees; got: 10testunit required: 0testunit: insufficient fee
Codespace: sdk

Version

0.44

Steps to Reproduce

Submit a transaction to a network without calling the WithGas function in the tx factory. The incorrect error should be observable in the logs, or in the response if trace is true.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@amaury1093
Copy link
Contributor

Thanks for the issue @mvid!

You're submitting a tx with no gas, and the node may require a min gas price, so this error seems like the expected behavior to me. What is the expected solution you're thinking of?

@mvid
Copy link
Contributor Author

mvid commented Sep 17, 2021

Thanks @AmauryM. I believe that the transaction should fail, but the error message isn't correct. Most obvious is that the error says you have more than the required fee but that is insufficient, which doesn't make sense. Perhaps the transaction should fail before the gas gets multiplied by the gas limit?

@amaury1093
Copy link
Contributor

Ah understood. One possible solution could be to just simply require a non-zero GasLimit, e.g. in the Tx.ValidateBasic, which will throw a more human-friendly error before that error. What do you think @mvid ?

@jackzampolin
Copy link
Member

@AmauryM we would like the ability to run 0 fee networks. This path would eliminate that.

@amaury1093
Copy link
Contributor

@AmauryM we would like the ability to run 0 fee networks. This path would eliminate that.

No I dont think so. If the node's minGasPrice is 0, you can still send a tx with 0 fee amount. I'm just saying that maybe gas_limit could be non-zero.

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 20, 2021

@AmauryM is correct here. GasLimit should always be positive. We should just enforce this in the ante-handler IMO. Quick fix. Chains that don't want to enforce positive GasLimit can just use their own decorator.

@robert-zaremba
Copy link
Collaborator

What would be a case for having a zero GasLimit?

@robert-zaremba
Copy link
Collaborator

I will have a look into this issue and try to solve it.

@amaury1093
Copy link
Contributor

@alexanderbez am I correct that your PR #12416 closes this issue?

@alexanderbez
Copy link
Contributor

Woaa didn't even know this existed! Yes, closing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

6 participants