question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change how transaction status polling is done

See original GitHub issue

Currently we send transactions in near-api-js using broadcast_tx_commit and it caused issues like https://github.com/near/near-api-js/issues/127 because nearcore will return an unstructured error for timeout and it makes it difficult to handle on the client side. However, not only does the error on nearcore side take longer time to fix, broadcast_tx_commit is also not really the best way to submit transactions. I suggest that we use a combination of EXPERIMENTAL_broadcast_tx_sync and EXPERIMENTAL_check_tx to handle transaction submission and status checking on near-api-js side. This completely eliminates the possibility of timeout error from nearcore side and allows more flexibility for polling transaction status as there is no internal polling in nearcore in either EXPERIMENTAL_broadcast_tx_sync or EXPERIMENTAL_check_tx.

Some caveats:

  • Errors need to be handled properly. When EXPERIMENTAL_check_tx returns InvalidNonce for example, it actually means that the transaction likely has already succeeded and therefore the nonce on the access key has increased, making the original transaction invalid.
  • When EXPERIMENTAL_check_tx returns None, it means that the transaction is still valid, but this might imply that something went wrong in between (get stuck in mempool for example). So near-api-js should have some timeout on its own to decide that the transaction is not accepted and a new one should be sent.

@vgrichina @kcole16 What do you think?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
bowenwang1996commented, Jul 9, 2020

@vgrichina it is available on betanet and will be released to testnet next Monday. Given that it is already Thursday I won’t think it makes sense for me to patch testnet with this commit right now.

0reactions
frolcommented, Aug 3, 2020

It appears that something doesn’t work very well. I have seen people reporting nonce issues and other issues with retry. We should probably look into it.

Seems to be resolved in https://github.com/nearprotocol/nearcore/pull/3061

Read more comments on GitHub >

github_iconTop Results From Across the Web

5.17.7 Status Polling - WebNMS
Controls the periodic poll on MOs i.e., only if this is enabled, Web NMS will status poll the mo periodically (during every status...
Read more >
Conducting polls in meetings - Zoom Support
How to add poll questions for a meeting · Click the Untitled Question area to edit the name of that polling question. ·...
Read more >
Poll for Job Status (Lambda, AWS Batch) - AWS Step Functions
This sample project creates an AWS Batch job poller. It implements an AWS Step Functions state machine that uses AWS Lambda to create...
Read more >
What to Expect at the Polling Place
With the Optical Scan Voting System, here's what to expect when you go to the polls - whether voting early or at your...
Read more >
Chapter 2 Voter Registration - State of Michigan
Residence for the purposes of registration and voting is defined according to Michigan election law, as a “place at which a person habitually...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found