Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Call cancel on unknown errors for iterative transactions. #587
  • Loading branch information
afalaleev committed Feb 21, 2022
commit b0f0aaac74d18eee859c4d08c1d1b437d3ab3259
10 changes: 7 additions & 3 deletions proxy/common_neon/solana_interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ def __init__(self, sender, tx_list: [Transaction], name: str,
self._pending_list = []
self._budget_exceeded_list = []
self._storage_bad_status_list = []
self._unknown_error_list = []

self._all_tx_list = [self._node_behind_list,
self._bad_block_list,
Expand Down Expand Up @@ -546,7 +547,7 @@ def send(self) -> SolTxListSender:
if custom in (1, 4):
self._storage_bad_status_list.append(receipt)
else:
raise SolTxError(receipt)
self._unknown_error_list.append(receipt)
else:
success_cnt += 1
self._on_success_send(tx, receipt)
Expand All @@ -558,7 +559,8 @@ def send(self) -> SolTxListSender:
f'bad blocks {len(self._bad_block_list)}, ' +
f'blocked accounts {len(self._blocked_account_list)}, ' +
f'budget exceeded {len(self._budget_exceeded_list)}, ' +
f'bad storage: {len(self._storage_bad_status_list)}')
f'bad storage: {len(self._storage_bad_status_list)}, ' +
f'unknown error: {len(self._unknown_error_list)}')

self._on_post_send()

Expand All @@ -581,7 +583,9 @@ def _on_success_send(self, tx: Transaction, receipt: {}) -> bool:
return False

def _on_post_send(self):
if len(self._node_behind_list):
if len(self._unknown_error_list):
raise SolTxError(self._unknown_error_list[0])
elif len(self._node_behind_list):
self.warning(f'Node is behind by {self._slots_behind} slots')
time.sleep(1)
elif len(self._storage_bad_status_list):
Expand Down
7 changes: 7 additions & 0 deletions proxy/common_neon/transaction_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,13 @@ def _on_post_send(self):
self.warning(f'Node is behind by {self._slots_behind} slots')
time.sleep(1)

# Unknown error happens - cancel the transaction
if len(self._unknown_error_list):
self._unknown_error_list.clear()
if not self._is_canceled:
self._cancel()
return

# There is no more retries to send transactions
if self._retry_idx >= RETRY_ON_FAIL:
if not self._is_canceled:
Expand Down
7 changes: 2 additions & 5 deletions proxy/indexer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def get_accounts_from_storage(solana: SolanaInteractor, storage_account, *, logg
if info is None:
raise Exception(f"Can't get information about {storage_account}")

if info.tag == 0:
if info.tag in (0, 1, 4):
logger.debug("Empty")
return None
elif info.tag == 3:
else:
logger.debug("Not empty storage")

acc_list = []
Expand All @@ -62,9 +62,6 @@ def get_accounts_from_storage(solana: SolanaInteractor, storage_account, *, logg
offset += 32

return acc_list
else:
logger.debug("Not empty other")
return None


@logged_group("neon.Indexer")
Expand Down