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

Loopring balances fail to load if account owns USDT in loopring #2400

Closed
1 task
kelsos opened this issue Feb 18, 2021 · 3 comments
Closed
1 task

Loopring balances fail to load if account owns USDT in loopring #2400

kelsos opened this issue Feb 18, 2021 · 3 comments
Labels
backend bug Something isn't working
Milestone

Comments

@kelsos
Copy link
Member

kelsos commented Feb 18, 2021

Problem Definition

When the account has USDT in loopring the balance fails to load due to the following exception:

Exception Name: <class 'rotkehlchen.errors.UnsupportedAsset'>
Exception Info: Found asset USDT which is not supported.
Traceback:
   File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "rotkehlchen/api/rest.py", line 268, in _do_query_async
  File "rotkehlchen/api/rest.py", line 1947, in _eth_module_query
  File "rotkehlchen/chain/ethereum/l2/loopring.py", line 350, in get_balances
  File "rotkehlchen/chain/ethereum/l2/loopring.py", line 317, in get_account_balances
  File "rotkehlchen/chain/ethereum/utils.py", line 67, in asset_normalized_value

Task

  • Fix the cause for the exception
@kelsos kelsos added the backend label Feb 18, 2021
@LefterisJP LefterisJP changed the title Loopring balances fail to load Loopring balances fail to load if account owns USDT in loopring Feb 18, 2021
@LefterisJP LefterisJP added the bug Something isn't working label Feb 18, 2021
@LefterisJP LefterisJP added this to the v1.15.0 milestone Feb 18, 2021
@kelsos kelsos modified the milestones: v1.15.0, v1.14.2 Feb 18, 2021
@LefterisJP
Copy link
Member

So ehm ...

asset = TOKENID_TO_ASSET.get(token_id, None)
if asset is None:
self.msg_aggregator.add_warning(
f'Ignoring loopring balance of unsupported token with id {token_id}',
)
continue
# not checking for UnsupportedAsset since this should not happen thanks
# to the mapping above
amount = asset_normalized_value(amount=total, asset=asset)
try:
usd_price = Inquirer().find_usd_price(asset)
except RemoteError as e:
self.msg_aggregator.add_error(
f'Error processing loopring balance entry due to inability to '
f'query USD price: {str(e)}. Skipping balance entry',
)
continue
balances[asset] = Balance(amount=amount, usd_value=amount * usd_price)

Look at the comment and look at the raised exception on the bug. I mean lol wtf?

@LefterisJP
Copy link
Member

Okay found the problem. It can be solved in two ways. Good news is one of them involves only changes in all_assets.json so not even a new release. Let me work on it.

LefterisJP added a commit to LefterisJP/rotkehlchen that referenced this issue Feb 18, 2021
Having an asset as "ethereum token and more" is only for semantic
purposes at the moment such as in USDT also being an Omni token.

Changing USDT to be only an ethereum token here so that rotki#2400 can be
fixed for users without actually making a release since their rotki
will automatically pull new all_assets.json and by having USDT as
ethereum only the exception will not be raised.

Once the proper fix for rotki#2400 is in then we should actually revert this
@LefterisJP
Copy link
Member

Good news is one of them involves only changes in all_assets.json so not even a new release. Let me work on it.

Okay so turns out this was wrong due to the asset in question, USDT, being loaded as part of constants.py before even we replace the local version.

But it's fixed in bugfixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants