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

Fixes for etherscan #8346

Merged
merged 2 commits into from
Aug 1, 2024
Merged

Fixes for etherscan #8346

merged 2 commits into from
Aug 1, 2024

Conversation

@@ -544,6 544,9 @@ def query_balances(
xpub_manager.check_for_new_xpub_addresses(blockchain=blockchain) # type: ignore # is checked in the if
else: # all chains
for chain in SupportedBlockchain:
if chain.is_evm() and len(self.accounts.get(chain)) == 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only for evm?

Copy link
Member Author

@yabirgb yabirgb Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eth2 is an exception since we don't have a balance structure for them and bitcoin does the detection of new addresses on xpub. If we change it we can adjust it. But both eth2 and btc do check before executing logic if there are addresses added

rotkehlchen/chain/evm/node_inquirer.py Outdated Show resolved Hide resolved
rotkehlchen/chain/evm/node_inquirer.py Outdated Show resolved Hide resolved
rotkehlchen/externalapis/etherscan.py Outdated Show resolved Hide resolved
@yabirgb yabirgb force-pushed the fixes-etherscan branch 3 times, most recently from 743d29f to af8ec47 Compare July 31, 2024 11:41
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.

Project coverage is 53.78%. Comparing base (600a700) to head (e5c2a90).
Report is 4 commits behind head on bugfixes.

Files Patch % Lines
rotkehlchen/tasks/assets.py 0.00% 1 Missing and 1 partial ⚠️
rotkehlchen/tasks/manager.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           bugfixes    #8346       /-   ##
============================================
  Coverage     53.77%   53.78%    0.01%     
============================================
  Files          1708     1709        1     
  Lines        168799   168952      153     
  Branches      13951    13986       35     
============================================
  Hits          90769    90879      110     
- Misses        75611    75647       36     
- Partials       2419     2426        7     
Flag Coverage Δ
backend 80.87% <66.66%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Etherscan requires an API key in ethereum to perform queries
in the RPC endpoint. Instead of making a request and wait for it to
fail raise remoteError before querying
@yabirgb yabirgb force-pushed the fixes-etherscan branch 2 times, most recently from 994c0ad to 3517d89 Compare July 31, 2024 16:53
rotkehlchen/chain/evm/node_inquirer.py Outdated Show resolved Hide resolved
rotkehlchen/externalapis/etherscan.py Outdated Show resolved Hide resolved
api_key = ApiKey(raw_key) # we warn right before that a key is needed
log.debug(f'Using default etherscan key for {self.chain}')
else:
self.msg_aggregator.add_error(msg := f'Etherscan for {self.chain} was queried but requires an API key. Please add one.') # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I get this. What we need to achieve is:

  1. If there is no api key use default. But warn user as we do now that they need an api key
  2. If there is an api key from the user use that.

There are several steps for the different chains and not in all of them
we are checking if the number of accounts is 0. Check it before calling
the logic of the EVM chain.

api_key = ApiKey(ROTKI_INCLUDED_KEYS[self.chain])
log.debug(f'Using default etherscan key for {self.chain}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Won';t this spam the logs? We can probably see that the default key is being used as api key is also logged in the logs right?

On the other hand seeing this ins the logs would point us to a user who needs to take action. Not sure what's best.

Copy link
Member

@LefterisJP LefterisJP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LefterisJP LefterisJP merged commit 371ddca into rotki:bugfixes Aug 1, 2024
14 checks passed
@rotkibot
Copy link

rotkibot commented Aug 1, 2024

rotki/test-caching/tree/fixes-etherscan was successfully merged

@yabirgb yabirgb deleted the fixes-etherscan branch August 3, 2024 10:57
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 this pull request may close these issues.

3 participants