Lesson 9: Mocha timeOut Error when running Staging test #1403
-
The Problem Code breaks when reaching the following line: It enters Raffle properly and fetches starting balance but doesn't resolve promise nor does it call VRF & Keepers. | VRF / Keepers |
================================================================================= Debugging I started the entire lesson over from scratch hoping to pin point the issue or any detail missed but still ended up with the same unresolved issue. Checked:
I tried:
=============================================================================== Code Deployed contract address: |Staging Test|
============================================================================ |Hardhat.config|
============================================================================== |Helper-hardhat-config|
================================================================================= |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 11 replies
-
Make a repo and reply with the link -- I will look into it |
Beta Was this translation helpful? Give feedback.
-
@DorianDaSilva check your upkeep because if I recall correctly you need to fund it with more than 10 LINK (I believe that there is a reference that Patrick makes in the course that it should be 13 LINK instead of the 8 LINK or so that he funds it with during the lesson). I know that caused issues for me when I first tried to deploy. |
Beta Was this translation helpful? Give feedback.
-
For some reason Chainlink Keepers works very slowly on the Rinkeby network. I tried the Kovan network for Keeper, it worked fine, but it has no Chainlink VRF. Rinkeby is the only option unfortunately |
Beta Was this translation helpful? Give feedback.
-
I get this exact same error. Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
@DorianDaSilva Honestly ive been on this same issue for days, it seems there is no solution for it.. |
Beta Was this translation helpful? Give feedback.
-
Yes, The code does problems when using I think you should try this approach: //entering the raffle
console.log("Entering Raffle...")
const txResponse = await Raffle.enterRaffle({ value: raffleEntranceFee })
const txReceipt = await txResponse.wait(6);
console.log("Time to wait...")
// emit accepts two parameters, 1st is contract, which will emit event, 2nd is event name in string form
expect(txReceipt).to.emit(Raffle, "WinnerPicked"); // Expect the event to fire,
// Now the event is emitted, we can run our code to test for things after event is fired
console.log("WinnerPicked event fired")
try {
//asserts
console.log("Made it here!!!")
const recentWinner = await Raffle.getRecentWinner()
const raffleState = await Raffle.getRaffleState()
const winnerEndingBalance = await accounts[0].getBalance()
const endingTimeStamp = await Raffle.getLatestTimestamp()
await expect(Raffle.getPlayer(0)).to.be.reverted
assert.equal(recentWinner.toString(), accounts[0].address) //deployer
assert.equal(raffleState, 0)
assert.equal(
winnerEndingBalance.toString(),
winnerStartingBalance.add(raffleEntranceFee).toString()
)
assert(endingTimeStamp > startingTimeStamp)
} catch (error) {
console.log(error)
}
|
Beta Was this translation helpful? Give feedback.
-
The staging tests are a bit more optional as a lot of stuff can error with them, I'd focus on the local pieces and really only attempt to fix the staging tests if you're going to be deploying to a mainnet. Some of the testnet errors can be elusive :/ |
Beta Was this translation helpful? Give feedback.
-
I am also having this same exact issue. The winnerPicked function doesn't get called. I am running this on a goerli network. Does anyone have a solve for this? |
Beta Was this translation helpful? Give feedback.
-
I faced the same problem and I solved it by replacing |
Beta Was this translation helpful? Give feedback.
-
Error: Timeout of 400000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Hope this will help. |
Beta Was this translation helpful? Give feedback.
The staging tests are a bit more optional as a lot of stuff can error with them, I'd focus on the local pieces and really only attempt to fix the staging tests if you're going to be deploying to a mainnet.
Some of the testnet errors can be elusive :/