near-cli icon indicating copy to clipboard operation
near-cli copied to clipboard

near-shell reports conflicting nonce error

Open evgenykuzyakov opened this issue 4 years ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

Sometimes near-shell shows a nonce conflict error. I think it happens because near-shell tries to resubmit the transaction that was accepted and processed.

node1, node2 and node3 all have separate accounts and keys. The commands is issued in order in a bash script:

for (( i=1; i<=$LAST_NODE; i++ )); do
ACCOUNT_ID="node$

{i} 

"
near stake $ACCOUNT_ID "ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX" 0
done;

Part of the log from near-shell calls towards localnet.

 Staking 0 (0) on node1 with public key = ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX.
 Loaded master account node0 key from /Users/ekwork/.near/validator_key.json with public key = ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX
 Transaction Id 5UpyjbdU6kdANs7DRbBCQspy63GhtWm8GGEZfphxvis4
 Staking 0 (0) on node2 with public key = ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX.
 Loaded master account node0 key from /Users/ekwork/.near/validator_key.json with public key = ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX
 Transaction Id 77UJgWD6LnR9V4sq4Ae4dVT7ahU9EYPsN2kbR8vNJgPs
 Staking 0 (0) on node3 with public key = ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX.
 Loaded master account node0 key from /Users/ekwork/.near/validator_key.json with public key = ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX
 Error: TypedError: <span class="error">[-32000]</span> Server error: Invalid transaction: Transaction nonce 1 must be larger than nonce of the used access key 1
 at JsonRpcProvider.sendJsonRpc (/Users/ekwork/.config/yarn/global/node_modules/near-api-js/lib/providers/json-rpc-provider.js:157:27)

To Reproduce Flaky. Issue staking call.

Expected behavior Not throw this error. (It might be on RPC side)

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Version: either 0.24.8 or 0.24.9

Additional context

Doesn't always happen, but @bowenwang1996 says more people saw similar errors.

evgenykuzyakov avatar Jul 23 '20 04:07 evgenykuzyakov