Skip to content

Commit 75839e5

Browse files
committed
properly handle no_retry in Web3Advanced.eth for .call and .get_logs
1 parent 6f80dd8 commit 75839e5

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

IceCreamSwapWeb3/EthAdvanced.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ def call(
7878
block_identifier: Optional[BlockIdentifier] = None,
7979
state_override: Optional[CallOverride] = None,
8080
ccip_read_enabled: Optional[bool] = None,
81-
no_retry: bool = None,
81+
no_retry: bool = False,
8282
):
83-
if "no_retry" in transaction:
83+
if not self.w3.should_retry:
84+
no_retry = True
85+
elif "no_retry" in transaction:
8486
no_retry = transaction["no_retry"]
8587
del transaction["no_retry"]
8688

@@ -92,7 +94,16 @@ def call(
9294
no_retry=no_retry,
9395
)
9496

95-
def get_logs(self, filter_params: FilterParams, show_progress_bar=False, p_bar=None) -> list[LogReceipt]:
97+
def get_logs(
98+
self,
99+
filter_params: FilterParams,
100+
show_progress_bar: bool = False,
101+
p_bar=None,
102+
no_retry: bool = False
103+
) -> list[LogReceipt]:
104+
if not self.w3.should_retry:
105+
no_retry = True
106+
96107
# getting the respective block numbers, could be block hashes or strings like "latest"
97108
from_block = filter_params["fromBlock"]
98109
to_block = filter_params["toBlock"]
@@ -131,7 +142,7 @@ def get_logs(self, filter_params: FilterParams, show_progress_bar=False, p_bar=N
131142
events = self._get_logs(filter_params)
132143
except Exception:
133144
# if errors should not be retried, still do splitting but not retry if it can not be split further
134-
if not self.w3.should_retry and num_blocks == 1:
145+
if no_retry and num_blocks == 1:
135146
raise
136147
else:
137148
if p_bar is not None:

0 commit comments

Comments
 (0)