Lesson 9: Issue with: Error VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()' #5695
Answered
by
Nlferu
Glow-in-the-dark
asked this question in
Q&A
-
Not sure how to debug/fix the "invalid Consumer()' Error This portion of my raffle.test.js failed. it("doesn't allow entrance when raffle is calculating", async function () {
await expect(raffle.enterRaffle({ value: raffleEntranceFee }));
await network.provider.send("evm_increaseTime", [
interval.toNumber() + 1,
]);
await network.provider.send("evm_mine", []); // we use [] empty array cause we just want to mine 1 empty block
// await network.provider.request({ method: "evm_mine", params: [] }); // same as above, but top one more succinct
// Since we enterRaffle, and it should be "isOpen", "timePassed", "hasPlayer", "hasBalance" all true,
// Then now we can PRETEND to be a chainlink keeper, to call performUpkeep().
await raffle.performUpkeep([]); // we pass an empty [], because it's an empty calldata.
// NOW, this should be in a "CALCULATING" state.
await expect(
raffle.enterRaffle({ value: raffleEntranceFee })
).to.be.revertedWith("Raffle__NotOpen");
}); This is my repo if needed. |
Beta Was this translation helpful? Give feedback.
Answered by
Nlferu
Jun 18, 2023
Replies: 1 comment 4 replies
-
Hello @Glow-in-the-dark The problem is with your deploy script I believe. } else {
// else if it is live Testnet's network instead,
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"];
subscriptionId = networkConfig[chainId]["subscriptionId"]; // In this case, we hardcoded it because we use the website UIUX to get it, but we can automate it like above too.
} Here you are getting subscriptionId from your 31337: {
name: "localhost",
subscriptionId: "0",
}, This should fix your problem, if not let me know |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Additionally I think you are missing adding consumer in your deploy script:
Without this your subscriptionId will throw you invalidConsumer as it is not added to vrf list. You can additionally checkout my repo here for fully automated process for all networks.