subdomain-registrar icon indicating copy to clipboard operation
subdomain-registrar copied to clipboard

Registrar has nonce issues if issuing two tx's without confirmation

Open hstove opened this issue 3 years ago • 4 comments

The registrar uses a naive approach for getting the current nonce - which is just to call /v2/accounts and get the current nonce. This does not reflect any tx's in the mempool. If the registrar makes a name_update tx and then makes another one before the first was confirmed, the second tx will get rejected due to a conflicting nonce error.

This can be worked around with a longer "batch interval" configuration - but it's not ideal.

Two options to do a better job:

  • Get all pending tx's for the registrar payer, and if there is a pending tx, use the highest nonce + 1
  • Store tx nonce's in the database, and use the next highest one

hstove avatar Mar 29 '21 16:03 hstove

Isn't this a more general problem with nonce's? When I make a transaction in the Boom wallet (nonce 10), for example to transfer an NFT, then return to the hiro web wallet to make a transfer it will try to do so with the same nonce (10), if the Boom transaction was not yet confirmed. Could the application simply count the number of pending transactions (x) and add those to nonce value (10+x) of the last confirmed transaction? Counting on there being only one transaction pending may not suffice anyway.

If all applications are experiencing these sort of issues should this be solved elsewhere, could it merit a SIP?

314159265359879 avatar Mar 30 '21 19:03 314159265359879

Does the registrar retry transactions upon failure for whatever reason, nonce or otherwise?

markmhendrickson avatar Mar 31 '21 09:03 markmhendrickson

Does the registrar retry transactions upon failure for whatever reason, nonce or otherwise?

Yes, It periodically checks for subdomains with received status in the local DB and calls name-update, for them.

asimm241 avatar Mar 31 '21 17:03 asimm241

Great 💪 Given those retries, this doesn't appear urgent for resolution before we deploy the updated registrar for mainnet.

markmhendrickson avatar Apr 01 '21 10:04 markmhendrickson