pull/3496/head
KPrasch 2024-05-30 11:01:50 +02:00
parent bdd66f2289
commit 2d8a5baf1b
No known key found for this signature in database
3 changed files with 6 additions and 5 deletions

View File

@ -54,8 +54,8 @@ from nucypher.blockchain.eth.trackers import dkg
from nucypher.blockchain.eth.trackers.bonding import OperatorBondedTracker
from nucypher.blockchain.eth.utils import (
get_healthy_default_rpc_endpoints,
truncate_checksum_address,
rpc_endpoint_health_check,
truncate_checksum_address,
)
from nucypher.crypto.powers import (
CryptoPower,

View File

@ -80,7 +80,7 @@ def rpc_endpoint_health_check(endpoint: str, max_drift_seconds: int = 60) -> boo
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["latest", False],
"id": 1
"id": 1,
}
LOGGER.debug(f"Checking health of RPC endpoint {endpoint}")
try:
@ -88,7 +88,7 @@ def rpc_endpoint_health_check(endpoint: str, max_drift_seconds: int = 60) -> boo
endpoint,
json=query,
headers={"Content-Type": "application/json"},
timeout=5
timeout=5,
)
except requests.exceptions.RequestException:
LOGGER.debug(f"RPC endpoint {endpoint} is unhealthy: network error")
@ -140,7 +140,9 @@ def get_default_rpc_endpoints() -> Dict[int, List[str]]:
LOGGER.debug("Fetching default RPC endpoints from remote chainlist")
response = requests.get(CHAINLIST_URL)
if response.status_code == 200:
return {int(chain_id): endpoints for chain_id, endpoints in response.json().items()}
return {
int(chain_id): endpoints for chain_id, endpoints in response.json().items()
}
else:
LOGGER.error(
f"Failed to fetch default RPC endpoints: {response.status_code} | {response.text}"

View File

@ -150,4 +150,3 @@ def mock_multichain_configuration(module_mocker, testerchain):
module_mocker.patch.object(
Operator, "_make_condition_provider", return_value=testerchain.provider
)