-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Feature request: wait for n confirmations between migration transactions (nonce too low error with Infura) #763
Comments
Small update @skmgoldin. This is a really good idea - adding it to the work underway to migrate to Web3 1.0 at truffle-contract 95. We could have module.exports = function (deployer) {
deployer.then(function() {
return new Promise(function(accept, reject){
deployer
.deploy(MyContract)
.on("confirmation", (number, receipt) => {
if (number === 10) accept(receipt);
})
.catch(reject)
});
}).then(function(receipt){
//... ready to deploy something else ...
}).catch(function(error){
// ... :/ ...
})
}); For record keeping, these are related:
|
This would be great, I hit this often when minting large amounts of nfts 👍 |
Suffering on this as well. I had to take the code to the remix to deploy, having failed from this error several times and it's costing too much real money..😭 |
Just had the "nonce too low" issue. |
Any workarounds at the moment? |
I just used remix to deploy. |
Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem. |
There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks! |
Just got this as well. |
I got stuck on this issue too. This workaround solved it for me: |
Issue
Deploying to mainnet via INFURA using Truffle is susceptible to breaking. Errors I've seen:
gas price too low
This happens when a tx is in the mempool and you send another tx with the same nonce.
nonce too low
This happens when a tx has been mined but you send another tx with the same nonce.
These things can happen when you talk to INFURA because they run many nodes behind a load balancer. Lets say you send a tx to node A, which later tells you the tx has been mined. Truffle now prepares to move onto the next tx it needs to send and queries INFURA for the nonce it should use for the sending address, and happens to get routed to node B. The block that node A saw hasn't propagated to node B yet, so node B tells you to use the nonce of the prior transaction!
Steps to Reproduce
You can't reproduce it deterministically, and it really only happens on mainnet because the peering situation is apparently bad, but try deploying something with a few txs to mainnet. Use this repo if you like: https://github.com/skmgoldin/tcr
Expected Behavior
The issue could be resolved if I could specify to Truffle a number of blocks to wait after a tx has been mined before sending the next tx.
When the number of blocks has elapsed, Truffle should double check at that point that the original transaction was actually mined, since it's possible it got the original mined alert for a block that ultimately wound up uncle'd. If that block was in fact uncle'd, wait again for the tx to be mined and repeat.
Actual Results
I can't specify a block depth to wait on. So I get these failures.
Environment
The text was updated successfully, but these errors were encountered: