Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidNonce error when creating multiple new safes #44

Open
adzialocha opened this issue Apr 8, 2021 · 0 comments
Open

InvalidNonce error when creating multiple new safes #44

adzialocha opened this issue Apr 8, 2021 · 0 comments
Labels

Comments

@adzialocha
Copy link

adzialocha commented Apr 8, 2021

Describe the bug

When deploying multiple safes with different accounts at the same time the relayer runs out of sync with the nonce throwing an InvalidNonce of the safe funder account.

[...]
2021-04-08 09:58:17,920 [INFO] [ForkPoolWorker-8] Task safe_relay_service.relay.tasks.begin_circles_onboarding_task[6f2c3e79-1334-4890-8e16-9487c8d701b4] succeeded in 0.015097220000825473s: None
2021-04-08 09:58:17,922 [INFO] [ForkPoolWorker-8] Check deploying Safe .. 0x56c78faBbcc81ccA973130b1C582fEb88EAe73eb
2021-04-08 09:58:17,929 [INFO] [ForkPoolWorker-8] Found 10000000000000000 balance for safe=0x56c78faBbcc81ccA973130b1C582fEb88EAe73eb with payment-token=None. Required=292013000000000
2021-04-08 09:58:17,978 [ERROR] [ForkPoolWorker-8] Task safe_relay_service.relay.tasks.circles_onboarding_safe_task[f82f1b47-77e3-4f2f-9e22-b6f141f97f13] raised unexpected: InvalidNonce('{\'message\': "the tx doesn\'t have the correct nonce. account has nonce of: 19 tx has nonce of: 18", \'code\': -32000, \'data\': {\'stack\': "n: the tx doesn\'t have the correct nonce. account has nonce of: 19 tx has nonce of: 18\\n    at i (/app/ganache-core.docker.cli.js:55:433387)\\n    at /app/ganache-core.docker.cli.js:55:433518\\n    at /app/ganache-core.docker.cli.js:42:104258\\n    at /app/ganache-core.docker.cli.js:42:279371\\n    at /app/ganache-core.docker.cli.js:42:283136\\n    at Object.return (/app/ganache-core.docker.cli.js:42:282709)\\n    at /app/ganache-core.docker.cli.js:42:281020\\n    at e (/app/ganache-core.docker.cli.js:42:283077)\\n    at /app/ganache-core.docker.cli.js:42:283058\\n    at /app/ganache-core.docker.cli.js:42:280210\\n    at processTicksAndRejections (internal/process/task_queues.js:75:11)", \'name\': \'n\'}}')
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 150, in with_exception_handling
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 1230, in send_raw_transaction
    return self.w3.eth.sendRawTransaction(bytes(raw_transaction))
  File "/usr/local/lib/python3.8/site-packages/web3/module.py", line 58, in caller
    result = w3.manager.request_blocking(method_str, params, error_formatters)
  File "/usr/local/lib/python3.8/site-packages/web3/manager.py", line 158, in request_blocking
    raise ValueError(response["error"])
ValueError: {'message': "the tx doesn't have the correct nonce. account has nonce of: 19 tx has nonce of: 18", 'code': -32000, 'data': {'stack': "n: the tx doesn't have the correct nonce. account has nonce of: 19 tx has nonce of: 18\n    at i (/app/ganache-core.docker.cli.js:55:433387)\n    at /app/ganache-core.docker.cli.js:55:433518\n    at /app/ganache-core.docker.cli.js:42:104258\n    at /app/ganache-core.docker.cli.js:42:279371\n    at /app/ganache-core.docker.cli.js:42:283136\n    at Object.return (/app/ganache-core.docker.cli.js:42:282709)\n    at /app/ganache-core.docker.cli.js:42:281020\n    at e (/app/ganache-core.docker.cli.js:42:283077)\n    at /app/ganache-core.docker.cli.js:42:283058\n    at /app/ganache-core.docker.cli.js:42:280210\n    at processTicksAndRejections (internal/process/task_queues.js:75:11)", 'name': 'n'}}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 405, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 697, in __protected_call__
    return self.run(*args, **kwargs)
  File "/safe-relay-service/safe_relay_service/relay/tasks.py", line 472, in circles_onboarding_safe_task
    SafeCreationServiceProvider().deploy_create2_safe_tx(safe_address)
  File "/safe-relay-service/safe_relay_service/relay/services/safe_creation_service.py", line 265, in deploy_create2_safe_tx
    ethereum_tx_sent = proxy_factory.deploy_proxy_contract_with_nonce(
  File "/usr/local/lib/python3.8/site-packages/gnosis/safe/proxy_factory.py", line 151, in deploy_proxy_contract_with_nonce
    tx_hash = self.ethereum_client.send_unsigned_transaction(tx, private_key=deployer_account.key)
  File "/usr/local/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 1283, in send_unsigned_transaction
    raise e
  File "/usr/local/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 1263, in send_unsigned_transaction
    return self.send_raw_transaction(signed_tx.rawTransaction)
  File "/usr/local/lib/python3.8/site-packages/gnosis/eth/ethereum_client.py", line 155, in with_exception_handling
    raise custom_exception(str(exc)) from exc
gnosis.eth.ethereum_client.InvalidNonce: {'message': "the tx doesn't have the correct nonce. account has nonce of: 19 tx has nonce of: 18", 'code': -32000, 'data': {'stack': "n: the tx doesn't have the correct nonce. account has nonce of: 19 tx has nonce of: 18\n    at i (/app/ganache-core.docker.cli.js:55:433387)\n    at /app/ganache-core.docker.cli.js:55:433518\n    at /app/ganache-core.docker.cli.js:42:104258\n    at /app/ganache-core.docker.cli.js:42:279371\n    at /app/ganache-core.docker.cli.js:42:283136\n    at Object.return (/app/ganache-core.docker.cli.js:42:282709)\n    at /app/ganache-core.docker.cli.js:42:281020\n    at e (/app/ganache-core.docker.cli.js:42:283077)\n    at /app/ganache-core.docker.cli.js:42:283058\n    at /app/ganache-core.docker.cli.js:42:280210\n    at processTicksAndRejections (internal/process/task_queues.js:75:11)", 'name': 'n'}}
[...]

Steps to reproduce

  1. Start Relayer in local circles-docker environment
  2. Run this test script against the relayer, which deploys 100 safes: https://gist.github.com/adzialocha/0800a0feb4c003402400a7d762652074
@adzialocha adzialocha changed the title Nonce out of sync when creating new safes InvalidNonce error when creating multiple new safes Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant