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

eth_estimateGas command with gasPrice param always returns "gas required exceeds allowance (0)" #21311

Closed
coinwalletdev opened this issue Jul 9, 2020 · 6 comments · Fixed by #21346

Comments

@coinwalletdev
Copy link

coinwalletdev commented Jul 9, 2020

System information

Geth/v1.9.15-stable-0f77f34b/linux-amd64/go1.14.4

Expected behaviour

eth_estimateGas on an ERC-20 transfer call should accepts the parameter gasPrice as the actual call does

Actual behaviour

Every time eth_estimateGas is called with gasPrice, {"code":-32000,"message":"gas required exceeds allowance (0)"} is answered

Steps to reproduce the behaviour

  1. Trying on geth:
  • with gasPrice:
$ curl -X POST -H "Content-Type: application/json"  --data "{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0xfa43b7400\",\"from\":\"0xc9f51aaf29433a2a916aa5fa704ef192db0d0d2d\",\"to\":\"0x38c87aa89b2b8cd9b95b736e1fa7b612ea972169\",\"data\":\"0xa9059cbb0000000000000000000000001bff412b4dcacc0bf61b9f18f8cfd45607a5a89300000000000000000000000000000000000000000000000000001b48eb57e000\"}],\"id\":45,\"jsonrpc\":\"2.0\"}" http://GETH_SERVER
{"jsonrpc":"2.0","id":45,"error":{"code":-32000,"message":"gas required exceeds allowance (0)"}}
  • without gasPrice:
$ curl -X POST -H "Content-Type: application/json"  --data "{\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xc9f51aaf29433a2a916aa5fa704ef192db0d0d2d\",\"to\":\"0x38c87aa89b2b8cd9b95b736e1fa7b612ea972169\",\"data\":\"0xa9059cbb0000000000000000000000001bff412b4dcacc0bf61b9f18f8cfd45607a5a89300000000000000000000000000000000000000000000000000001b48eb57e000\"}],\"id\":45,\"jsonrpc\":\"2.0\"}" http://GETH_SERVER
{"jsonrpc":"2.0","id":45,"result":"0xa78c"}
  1. Trying on parity:
  • works with gasPrice:
curl -X POST -H "Content-Type: application/json"  --data "{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0xfa43b7400\",\"from\":\"0xc9f51aaf29433a2a916aa5fa704ef192db0d0d2d\",\"to\":\"0x38c87aa89b2b8cd9b95b736e1fa7b612ea972169\",\"data\":\"0xa9059cbb0000000000000000000000001bff412b4dcacc0bf61b9f18f8cfd45607a5a89300000000000000000000000000000000000000000000000000001b48eb57e000\"}],\"id\":45,\"jsonrpc\":\"2.0\"}" http://PARITY_SERVER
{"jsonrpc":"2.0","result":"0x5a58","id":45}
@ligi
Copy link
Member

ligi commented Jul 9, 2020

is your node fully synced?

@coinwalletdev
Copy link
Author

is your node fully synced?

I have:

$ curl -X POST -H "Content-Type: application/json"  --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://GETH_SERVER
{"jsonrpc":"2.0","id":1,"result":false}

@rjl493456442
Copy link
Member

Are you sure the fund 0xc9f51aaf29433a2a916aa5fa704ef192db0d0d2d has is not zero? The capped gas limit is zero because there is NO associated fund.

@pinkiebell
Copy link
Contributor

Just stumbled on this thing, it's related to large account balances.
If you have a genesis file and some initial accounts like this:

     'df08f82de32b8d460adbe8d72043e3a7e25a3b39': {
-      'balance': '0x200000000000000000000000000000000000000000000000000000000000000',
+      'balance': '0x00000000000000000000000000000000000000000000ffffffffffffffffffff',
     },

using a much smaller number 'fixes' the issue. The last known good version was v1.9.9 if that helps.

@coinwalletdev
Copy link
Author

Seems fixed, thanks.

@Crypto2
Copy link

Crypto2 commented Nov 12, 2020

This does seem to still be broken in 1.9.23, or at least doesn't work as it always has before. For example if you want to send the whole ETH balance in an address, specifying the gasPrice has always worked fine even though the value + gas used would be more than the balance, since you were just trying to figure out how much gas to deduct from the send. Now it returns "gas required exceeds allowance (0)". Removing gasPrice does fix it, but you'd hate to have to rewrite all the software out there that relies on the existing behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants