Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Withdraw errors with high gas prices #4773

Closed
ederenn opened this issue Sep 27, 2019 · 5 comments
Closed

Withdraw errors with high gas prices #4773

ederenn opened this issue Sep 27, 2019 · 5 comments
Assignees
Labels
0.21 release bug P3 Severity-Low/Effort-hard

Comments

@ederenn
Copy link

ederenn commented Sep 27, 2019

Description

Golem Version: INFO 0.20.2+dev538.g964b8e3

Golem-Messages version (leave empty if unsure): golem_messages Version: 3.11.0

Electron version (if used): history_list_update_fix

OS [e.g. Windows 10 Pro]: Linux 18.04

Branch (if launched from source): b0.21

Mainnet/Testnet: mainnet

Priority label is set to the lowest by default. To setup higher priority please change the label
P0 label is set for Severity-Critical/Effort-easy
P1 label is set for Severity-Critical/Effort-hard
P2 label is set for Severity-Low/ Effort-easy
P3 label is set for Severity-Low/Effort-hard

Description of the issue:

When withdrawing eth from wallet when gas prices are high gives an error in GUI and golem.log

from debug logs:

2019-09-27 16:48:28 DEBUG    golem.ethereum.web3.providers       ProviderProxy.make_request('eth_estimateGas', [{'to': '0x5C99F6e8a04BcDc37e3BE0BC1Df43D597BA19843', 'from': '0x5C99F6e8a04BcDc37e3BE0BC1Df43D597BA19843', 'value': '-0x12309ce540000'}])

Actual result:

In withdrawal modal seems that transaction is unsuccessful but eth from wallet is sent. Sent amount is 10 times higher than requested. In confirmation modal amount is shown as a minus value.

Screenshots:

Screenshot from 2019-09-27 17-24-51

Steps To Reproduce

Short description of steps to reproduce the behavior:
e.g.

  1. Launch Golem,
  2. Gas prices should be high on ges station.
  3. Withdraw from eth wallet amount in pattern 0.000X
  4. In confirmation modal amount will be on minus
  5. Confirm
  6. See error in interface
  7. Check logs for error

Expected behavior

Golem should send required amount of money

Logs and any additional context

INFO     [golem.ethereum.transactionsystem   ] Trying to withdraw 0.000300 ETH to 0x5C99F6e8a04BcDc37e3BE0BC1Df43D597BA19843
ERROR    [twisted                            ] Session.onUserError(): "ValueError: {'code': -32602, 'message': 'invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go struct field CallArgs.value of type *hexutil.Big'}"
Traceback (most recent call last):
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/autobahn/twisted/websocket.py", line 322, in _onMessage
    self.onMessage(payload, isBinary)
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/autobahn/wamp/websocket.py", line 95, in onMessage
    self._session.onMessage(msg)
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/autobahn/wamp/protocol.py", line 1006, in onMessage
    on_reply = txaio.as_future(endpoint.fn, *invoke_args, **invoke_kwargs)
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/txaio/tx.py", line 429, in as_future
    return maybeDeferred(fun, *args, **kwargs)
--- <exception caught here> ---
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred
    result = f(*args, **kw)
  File "/home/ederenn/projects/golem/golem/client.py", line 1053, in withdraw
    gas_price,
  File "/home/ederenn/projects/golem/golem/ethereum/transactionsystem.py", line 62, in curry
    return f(self, *args, **kwargs)
  File "/home/ederenn/projects/golem/golem/ethereum/transactionsystem.py", line 657, in withdraw
    gas_price,
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/golem_sci/implementation.py", line 261, in transfer_eth
    startgas=self.estimate_transfer_eth_gas(to_address, amount),
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/golem_sci/implementation.py", line 285, in estimate_transfer_eth_gas
    'value': amount,
  File "/home/ederenn/projects/golem-env/lib/python3.6/site-packages/golem_sci/client.py", line 89, in estimate_gas
    return self.web3.eth.estimateGas(tx)
  File "/home/ederenn/projects/golem-env/src/web3/web3/eth.py", line 280, in estimateGas
    [transaction],
  File "/home/ederenn/projects/golem-env/src/web3/web3/manager.py", line 106, in request_blocking
    raise ValueError(response["error"])
builtins.ValueError: {'code': -32602, 'message': 'invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go struct field CallArgs.value of type *hexutil.Big'}

INFO     [golem.client                       ] Updating masks

golem.log

Proposed Solution?

(Optional: What could be a solution for that issue)

@ederenn ederenn added bug brass P3 Severity-Low/Effort-hard 0.21 release labels Sep 27, 2019
@etam etam self-assigned this Oct 15, 2019
@etam
Copy link
Contributor

etam commented Oct 16, 2019

This is one more important line from log:

2019-09-27 16:48:28 DEBUG    golem.ethereum.web3.providers       ProviderProxy.make_request('eth_estimateGas', [{'to': '0x5C99F6e8a04BcDc37e3BE0BC1Df43D597BA19843', 'from': '0x5C99F6e8a04BcDc37e3BE0BC1Df43D597BA19843', 'value': '-0x12309ce540000'}])

@etam
Copy link
Contributor

etam commented Oct 16, 2019

And here is PR that introduced the problem: #3802

It seems that if amount is low and gas price is high, then the resulting amount is negative and this is not handled.

@etam
Copy link
Contributor

etam commented Oct 16, 2019

@mdtanrikulu I've made a PR to golem to raise an exception in such case. But maybe you could also do some magic in GUI, to show the user that there is a problem. As you can see in screenshot, the amount to be withdrawn is smaller than gas price.

@mdtanrikulu
Copy link
Contributor

mdtanrikulu commented Oct 16, 2019

@etam Sure, I will make a check before and for after if I catch the exception and the magic will appear 🎉Thanks!

etam added a commit that referenced this issue Oct 21, 2019
@etam
Copy link
Contributor

etam commented Oct 21, 2019

fix merged to b0.21

@etam etam closed this as completed Oct 21, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
0.21 release bug P3 Severity-Low/Effort-hard
Projects
None yet
Development

No branches or pull requests

4 participants