Skip to content

Commit

Permalink
fix: use eth_retry to fetch client_version
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Dec 4, 2024
1 parent 25fb784 commit 1a68e61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dank_mids/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, w3: Web3) -> None:
self.chain_id = self.sync_w3.eth.chain_id
"""The chainid for the currently connected rpc."""

self.client_version: str = self.sync_w3.client_version if _helpers.w3_version_major >= 6 else self.sync_w3.clientVersion # type: ignore [attr-defined]
self.client_version: str = _get_client_version(self.sync_w3)
"""The client version for the currently connected rpc."""

# NOTE: We need this mutable for node types that require the full jsonrpc spec
Expand Down Expand Up @@ -410,6 +410,11 @@ def _select_mcall_target_for_block(self, block) -> "_MulticallContract":
return self.mc2 or self.mc3 # type: ignore [return-value]


@eth_retry.auto_retry
def _get_client_version(sync_w3: Web3) -> str:
return sync_w3.client_version if _helpers.w3_version_major >= 6 else sync_w3.clientVersion # type: ignore [attr-defined]


class _MulticallContract(Struct):
"""
Represents a multicall contract with its address, deployment block, and bytecode.
Expand Down

0 comments on commit 1a68e61

Please sign in to comment.