You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 17, 2024. It is now read-only.
So I get a timeout error as expeced. Then I added the timeout option and ran the test command hh test --network sepolia again. But now it throws another error.
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0xa39c478295F192A11ce9b6bFBF64240f0f0b3843","to":"0xAd170C5ca3091862c1f0C90FA0Ae4D46e7EB4D01","value":{"type":"BigNumber","hex":"0x2386f26fc10000"},"data":"0xc1af5785","accessList":null}, error={"name":"ProviderError","_stack":"ProviderError: execution reverted\n at HttpProvider.request (decentralized-lottery/node_modules/hardhat/src/internal/core/providers/http.ts:90:21)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at EthersProviderWrapper.send (decentralized-lottery/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":3,"_isProviderError":true,"data":"0xe76be6fc"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
Here's my staging test source code:
const{ assert, expect, ...chai}=require("chai");const{ solidity }=require("ethereum-waffle");const{ getNamedAccounts, ethers, network }=require("hardhat");const{DEVELOPMENT_CHAINS}=require("../../helper-hardhat.config");chai.use(solidity);DEVELOPMENT_CHAINS.includes(network.name)
? describe.skip
: describe("Lottery Staging",()=>{letlottery,lotteryEntranceFee,deployer;beforeEach(async()=>{deployer=(awaitgetNamedAccounts()).deployer;lottery=awaitethers.getContract("Lottery",deployer);lotteryEntranceFee=awaitlottery.getEntranceFee();});describe("fulfillRandomWords",()=>{it("should work with live ChainLink Keepers and VRF and get a random winner",async()=>{console.log("Setting up test...")letwinnerStartingBalance;conststartingTs=awaitlottery.getLatestTimestamp();const[deployerAccount]=awaitethers.getSigners();console.log("Setting up Listener...")awaitnewPromise(async(resolve,reject)=>{lottery.once("WinnerPicked",async()=>{console.log("WinnerPicked event triggered!");try{constrecentWinner=awaitlottery.getRecentWinner();constlotteryState=awaitlottery.getLotteryState();constwinnerEndingBalance=awaitdeployerAccount.getBalance();constendingTs=awaitlottery.getLatestTimestamp();awaitexpect(lottery.getPlayer(0)).to.be.reverted;assert.equal(recentWinner.toString(),deployerAccount.address);assert.equal(lotteryState,0);assert.equal(winnerEndingBalance.toString(),winnerStartingBalance.add(lotteryEntranceFee).toString(),);assert(endingTs>startingTs);resolve();}catch(error){console.error(error);reject(error);}});try{console.log("Entering Lottery...")consttx=awaitlottery.enterLottery({value: lotteryEntranceFee});awaittx.wait(1);console.log("Ok, time to wait...")winnerStartingBalance=awaitdeployerAccount.getBalance();}catch(error){console.error(error);reject(error);}});});});});
hmm... yes it's having a hard time estimating the gas costs... This might be a good one to skip the staging test on. A lot of the chainlink VRF stuff is really tricky on a testnet. Testnets aren't very reliable for running staging tests sadly.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I deployed my contract. But forgot to add
So I get a timeout error as expeced. Then I added the timeout option and ran the test command
hh test --network sepolia
again. But now it throws another error.Here's my staging test source code:
And here's
hardhat.config.js
file:The text was updated successfully, but these errors were encountered: