Lilypad-Tech / lilypad-modicum

This is the deprecated Lilypad v1. See https://github.com/bacalhau-project/lilypad for v2. Previous FEVM-Bacalhau bridge (v0): https://github.com/bacalhau-project/lilypad-v0
GNU General Public License v3.0
12 stars 8 forks source link

retry on nonce too low #53

Open lukemarsden opened 1 year ago

lukemarsden commented 1 year ago

as seen below, when there's contention on the smart contract because of the short block times we are more likely to see this, we just need to retry in the client

2023-07-17 12:19:02,606;ResourceProvider;🟠 post resource offer
Exception in thread Thread-1 (platformListener):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/app/modicum/ResourceProvider.py", line 303, in platformListener
    self.postDefaultOffer()
  File "/app/modicum/ResourceProvider.py", line 90, in postDefaultOffer
    self.postOffer({"request": "post",
  File "/app/modicum/ResourceProvider.py", line 78, in postOffer
    ).transact({
  File "/usr/local/lib/python3.10/dist-packages/web3/contract/contract.py", line 479, in transact
    return transact_with_contract_function(
  File "/usr/local/lib/python3.10/dist-packages/web3/contract/utils.py", line 172, in transact_with_contract_function
    txn_hash = w3.eth.send_transaction(transact_transaction)
  File "/usr/local/lib/python3.10/dist-packages/web3/eth/eth.py", line 362, in send_transaction
    return self._send_transaction(transaction)
  File "/usr/local/lib/python3.10/dist-packages/web3/module.py", line 68, in caller
    result = w3.manager.request_blocking(
  File "/usr/local/lib/python3.10/dist-packages/web3/manager.py", line 232, in request_blocking
    return self.formatted_response(
  File "/usr/local/lib/python3.10/dist-packages/web3/manager.py", line 205, in formatted_response
    raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'nonce too low: next nonce 120, tx nonce 119'}
lukemarsden commented 1 year ago

fixed in f51092ea026832ffca951b40745ce356ea1a0cbc

lukemarsden commented 1 year ago

didn't work. nonce was baked into raw transaction and retrying that is pointless