Repository: rotki/rotki

Issue:
Soft migration fails due to 403 from api.avax.network
## Problem Definition

A user reported on Discord that they kept seeing the following error (check Traceback)

The error does not block the login to the app, but because of the error the data migration never completes and it is always retried.

## Logs

```python
29/06/2023 18:23:06 CEST] ERROR rotkehlchen.data_migrations.manager Greenlet-5: Failed to run soft data migration to version 10 due to 403 Client Error: Forbidden for url: https://api.avax.network/ext/bc/C/rpc
Traceback (most recent call last):
  File "rotkehlchen/data_migrations/manager.py", line 73, in _perform_migration
  File "rotkehlchen/data_migrations/migrations/migration_10.py", line 59, in data_migration_10
  File "rotkehlchen/chain/aggregator.py", line 1459, in detect_evm_accounts
  File "rotkehlchen/chain/aggregator.py", line 1382, in check_chains_and_add_accounts
  File "rotkehlchen/chain/aggregator.py", line 1323, in check_single_address_activity
  File "web3/module.py", line 57, in caller
  File "web3/manager.py", line 197, in request_blocking
  File "web3/manager.py", line 150, in _make_request
  File "web3/middleware/formatting.py", line 94, in middleware
  File "web3/middleware/gas_price_strategy.py", line 90, in middleware
  File "web3/middleware/formatting.py", line 94, in middleware
  File "web3/middleware/attrdict.py", line 33, in middleware
  File "web3/middleware/formatting.py", line 94, in middleware
  File "web3/middleware/formatting.py", line 94, in middleware
  File "web3/middleware/formatting.py", line 94, in middleware
  File "web3/middleware/buffered_gas_estimate.py", line 40, in middleware
  File "web3/middleware/exception_retry_request.py", line 105, in middleware
  File "web3/providers/rpc.py", line 88, in make_request
  File "web3/_utils/request.py", line 113, in make_post_request
  File "requests/models.py", line 1021, in raise_for_status
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.avax.network/ext/bc/C/rpc
```


### System Description


Operating system: 
Rotki version: 1.29



Discussion:

Resolving patch:
diff --git a/rotkehlchen/chain/aggregator.py b/rotkehlchen/chain/aggregator.py
--- a/rotkehlchen/chain/aggregator.py
+++ b/rotkehlchen/chain/aggregator.py
@@ -6,6 +6,7 @@
 from pathlib import Path
 from typing import TYPE_CHECKING, Any, Callable, Literal, Optional, TypeVar, cast, overload
 
+import requests
 from gevent.lock import Semaphore
 from web3.exceptions import BadFunctionCallOutput
 
@@ -1318,11 +1319,16 @@ def check_single_address_activity(
             try:
                 if chain == SupportedBlockchain.AVALANCHE:
                     avax_manager = cast(AvalancheManager, chain_manager)
-                    # just check balance and nonce in avalanche
-                    has_activity = (
-                        avax_manager.w3.eth.get_transaction_count(address) != 0 or
-                        avax_manager.get_avax_balance(address) != ZERO
-                    )
+                    try:
+                        # just check balance and nonce in avalanche
+                        has_activity = (
+                            avax_manager.w3.eth.get_transaction_count(address) != 0 or
+                            avax_manager.get_avax_balance(address) != ZERO
+                        )
+                    except (requests.exceptions.RequestException, RemoteError) as e:
+                        log.error(f'Failed to check {address} activity in avalanche due to {e!s}')
+                        has_activity = False
+
                     if has_activity is False:
                         continue
                 else:


Test patch: