Skip to content

Commit

Permalink
Retry nonce too low errors (#153)
Browse files Browse the repository at this point in the history
The nonce too low error is:

```
ValueError: {'code': -32000, 'message': 'nonce too low'}.
```

This might happen when we are broadcasting multiple transactions through multiple RPC providers using `eth_sendRawTransaction`. One provide is not yet seeing a transaction broadcast through the other provider.
  • Loading branch information
miohtama authored Sep 25, 2023
1 parent 500df33 commit 078ac4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.22.12

- Retry [nonce too low errors](https://github.com/tradingstrategy-ai/web3-ethereum-defi/pull/153),
(related to LLamaNodes).

# 0.22.11

- Add `eth_defi.provider.llamanodes` and work around issues with LlamaNodes.com
Expand Down
10 changes: 9 additions & 1 deletion eth_defi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@
#:
#: See GoEthereum error codes https://github.com/ethereum/go-ethereum/blob/master/rpc/errors.go
#:
DEFAULT_RETRYABLE_RPC_ERROR_CODES = (-32603,)
DEFAULT_RETRYABLE_RPC_ERROR_CODES = (
# ValueError: {'message': 'Internal JSON-RPC error.', 'code': -32603}
-32603,
# ValueError: {'code': -32000, 'message': 'nonce too low'}.
# Might happen when we are broadcasting multiple transactions through multiple RPC providers
# using eth_sendRawTransaction
# One provide has not yet seeing a transaction broadcast through the other provider.
-32000,
)


def is_retryable_http_exception(
Expand Down

0 comments on commit 078ac4d

Please sign in to comment.