Lesson 9: Staging test is getting timeout error (Chainlink issue). #729
-
As per the issue reported here. I am also getting same error, even for 500 sec timing. Attaching all the information Console error log fulfillRandomWords
works with live Chainlink Keepers and Chainlink VRF, we get a random winner:
Error: Timeout of 500000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\coding-learning\solidityjsbypatrick\hardhat-smartcontract-lottery\test\staging\Raffle.staging.test.ts) helper-network file const networkConfig: networkConfigInfo = {
4: {
name: "rinkeby",
vrfCoordinatorV2: "0x6168499c0cffcacd319c818142124b7a15e857ab",
raffleEntranceFee: "10000000000000000", // 0.01 ETH
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc", //30 gwei
subscriptionId: 7783,
callBackGasLimit: "500000", // 500,000 gas
keepersUpdateInterval: "30", // in seconds
},
.........
......
} chain link VRF screenshot
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 16 replies
-
Hy. Had the same issue and I solved it by setting my mocha.timeout to 300000 (300 seconds), in hardhat.config.js. You can even try with 200000 and try increasing it until you stop getting timed out. |
Beta Was this translation helpful? Give feedback.
-
@PatrickAlphaC function checkUpkeep(bytes memory /* checkData */ ) public view override returns ( bool upkeepNeeded, bytes memory /* performData */ ) {
bool isOpen = (RaffleState.Open == s_raffleState);
bool timePassed = ((block.timestamp - s_lastTimeStamp) > i_interval); //this is returning false on staging test
bool hasPlayers = (s_players.length > 0);
bool hasBalance = (address(this).balance > 0);
upkeepNeeded = (isOpen && timePassed && hasPlayers && hasBalance);
return (upkeepNeeded, "");
} This line is returning false bool timePassed = ((block.timestamp - s_lastTimeStamp) > i_interval); How we can further check or fix it? Do we need to do add interval manually in our staging code? as we did in unit test? |
Beta Was this translation helpful? Give feedback.
-
Update: console.log("Entering Raffle...");
const tx = await raffle.enterRaffle({ value: raffleEntranceFee });
await tx.wait(1);
winnerStartingBalance = await deployer.getBalance();
await raffle.performUpkeep("0x"); // add this line in your staging test The reason for this could be the way we are defining the type of keeper The |
Beta Was this translation helpful? Give feedback.
-
Look like I am wrong in my above comment. We don't need To me the error seems to be happening in function performUpkeep(
bytes calldata /* performData */
) external override {
(bool upkeepNeeded, ) = checkUpkeep(""); //This line is returning false.
if (!upkeepNeeded) {
revert Raffle__UpkeepNotNeeded(
address(this).balance,
s_players.length,
uint256(s_raffleState)
);
}
s_raffleState = RaffleState.Calculating;
uint256 requestId = i_vrfCoordinator.requestRandomWords(
i_gasLane,
i_subscriptionId,
REQUEST_CONFIRMATION,
i_callbackGasLimit,
NUM_WORDS
);
emit RequestRafflewinner(requestId);
}
My possible explanationNot sure but I think since chainlink call the I just commented/removed the below part from the (bool upkeepNeeded, ) = checkUpkeep("");
if (!upkeepNeeded) {
revert Raffle__UpkeepNotNeeded(
address(this).balance,
s_players.length,
uint256(s_raffleState)
);
} |
Beta Was this translation helpful? Give feedback.
-
Hi, I was facing this issue yesterday so I took a look through all my code today, checked the following files against those on the github repo and did not notice any differences. Without making any changes to my code, I ran the staging test again and it worked. Perhaps you can try running the staging test again to see if it works. Files that I checked against github repo:
Not experienced with typescript but I took a look through your code and did not notice any significant differences between your code and mine. Only differences I observed was that your subscriptionId is not wrapped in " " and your filepath in the import statement for KeeperCompatible.sol in Raffle.sol is different from mine. Might be worth a check but I am not certain if these are causing the issue you are facing. |
Beta Was this translation helpful? Give feedback.
-
@sanjayojha what was your final solution? I'm having the same error |
Beta Was this translation helpful? Give feedback.
-
Having the same issue: #967 It seems it is not resolving the promise. I also tried to chain the promise with vrf consumer shows up in etherscan with a bunch of transactions but keepers is not kicking in for some reason. |
Beta Was this translation helpful? Give feedback.
-
@sanjayojha Hello, Can you show me the terminal where you run the command? |
Beta Was this translation helpful? Give feedback.
Look like I am wrong in my above comment. We don't need
await raffle.performUpkeep("0x");
in our staging test file. Since its keeper work to invoke it.To me the error seems to be happening in
performUpkeep
method.