Skip to content

Commit

Permalink
fix: tenderly batch sort logic (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Nov 4, 2023
1 parent 9a75cc7 commit 0c6a995
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions dank_mids/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ def __init__(self, w3: Web3) -> None:
self.state_override_not_supported: bool = ENVS.GANACHE_FORK or self.chain_id == 100 # Gnosis Chain does not support state override.

self.endpoint = self.w3.provider.endpoint_uri
if "tenderly" in self.endpoint:
# NOTE: Tenderly does funky things sometimes
logger.warning(
"We see you're using a tenderly rpc.\n" +
"There is a known conflict between dank and tenderly which causes issues not present with other providers.\n" +
"Your milage may vary. Debugging efforts welcome."
)
self._sort_calls = "tenderly" in self.endpoint or "chainstack" in self.endpoint

self._instance: int = sum(len(_instances) for _instances in instances.values())
instances[self.chain_id].append(self) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion dank_mids/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def should_retry(self, e: Exception) -> bool:
async def spoof_response(self, response: List[RawResponse]) -> None:
# This means we got results. That doesn't mean they're good, but we got 'em.

if "tenderly" or "chainstack" in self.controller.endpoint:
if self.controller._sort_calls:
# NOTE: these providers don't always return batch results in the correct ordering
# NOTE: is it maybe because they
calls = sorted(self.calls, key=lambda call: call.uid)
Expand Down

0 comments on commit 0c6a995

Please sign in to comment.