Skip to content

Commit

Permalink
Move Base broadcast failure handling
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Jan 23, 2025
1 parent c39754c commit 524dc14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions eth_defi/confirmation.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,15 @@ def wait_and_broadcast_multiple_nodes_mev_blocker(
tx_hash_2 = backup_web3.eth.send_raw_transaction(tx.rawTransaction)
logger.info("Backup provider broadcast complete: %s", tx_hash.hex())
except ValueError as e:
logger.info("Backup broadcast failed: %s", e)
if "already known" in str(e):
# Will not retry, method eth_sendRawTransaction, as not a retryable exception <class 'ValueError'>: {'code': -32000, 'message': 'already known'}
# base-memex | 2025-01-18 17:42:39 eth_defi.confirmation
logger.info("Already known race condition: %s", str(e))
else:
raise e

logger.info("Received backup tx_hash: %s", tx_hash_2.hex())
else:
logger.info("Received backup receipt with has tx_hash: %s", tx.hash)

logger.debug("Starting MEV Blocker confirmation cycle, unconfirmed tx is: %s, sleeping poll delay %s", tx_hash.hex(), poll_delay)

Expand All @@ -973,7 +974,13 @@ def wait_and_broadcast_multiple_nodes_mev_blocker(
logger.info("Using receipt from the backup provider")
receipt = backup_provider_receipt
else:
logger.info("Attempting to fetch receipt")
receipt = full_web3.eth.get_transaction_receipt(tx_hash)

if not receipt:
logger.info("No receipt yet, keep trying")
continue

receipts[tx.hash] = receipt
last_exception = None
break
Expand Down Expand Up @@ -1002,7 +1009,7 @@ def wait_and_broadcast_multiple_nodes_mev_blocker(
raise ConfirmationTimedOut(
f"Run out of poll delay when confirming %d: %s, last exception is %s",
tx.nonce,
tx.hash.hex(),
tx.hash.hex() if tx_hash else '-',
last_exception,
) from last_exception
else:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ tqdm = {version = ">=4.66.1", optional = true}
# Some packages have still compatibility issues with Numpy 2.x release,
# too tired to deal with them now
numpy = {version = "<2", optional = true}
pandas = {version = ">=1.5", optional = true}
pandas = {version = ">=1.4", optional = true}
gql = {extras = ["requests"], version = "^3.3.0", optional = true}
jupyter = {version = "^1.0.0", optional = true}
matplotlib = {version = "^3.5.2", optional = true}
matplotlib = {version = ">=3.5", optional = true}
plotly = {version = "^5.8.2", optional = true}
pyarrow = {version = "*", optional = true}
pytest-xdist = {version = "^3.3.1", optional = true}
Expand Down

0 comments on commit 524dc14

Please sign in to comment.