0

Deployed a Raffle contract on Sepolia Testnet, The Raffle contract calls s_vrfCoordinator.requestRandomWords and it's status is in pending state for a while.

The subscription is funded as seen in the SS.

Any idea why it's still pending?

Thank you!

--- UPDATE --- changed numWords back to 1 and redeployed. The VRF request still hasn't fulfilled.

What is missing idk?

enter image description here

Chainlink VRF Subscription Details

1 Answer 1

1

I just tested it using this SimpleRaffle contract, and the request was fulfilled successfully within a minute.

VRF-Fulfillment-1

VRF-Fulfillment-2

You should try to increase the value of callbackGasLimit according to the number of random words/numbers that you're requesting. As you can see from my contract, I've used callbackGasLimit as 100_000 and numWords as 1.

requestId = s_vrfCoordinator.requestRandomWords(
    VRFV2PlusClient.RandomWordsRequest({
        keyHash: keyHash,
        subId: s_subscriptionId,
        requestConfirmations: requestConfirmations,
        callbackGasLimit: 100_000,
        numWords: 1,
        extraArgs: VRFV2PlusClient._argsToBytes(
            VRFV2PlusClient.ExtraArgsV1({
                nativePayment: enableNativePayment
            })
        )
    })
);

You can even get this callbackGasLimit value by passing it from the function argument, in order to test with different values depending on your use-case. Or, you can do something like:

callbackGasLimit: numberOfRandomWords * 100_000,
7
  • I changed the numWords to 1 and redeployed, it's still in pending state. It doesn't specify any reason for it.
    – att
    Commented Nov 8 at 9:54
  • What's the callbackGasLimit value that you're passing? Commented Nov 8 at 9:59
  • uint32 public callbackGasLimit = 100000;
    – att
    Commented Nov 8 at 10:06
  • 1
    Okay, so please try to fund your subscription with more LINK tokens, as it converts them to native token (i.e., ETH) to cover the gas fees and it also considers any potential gas spikes, and Sepolia network usually remains congested, so funding the subscription with over 50 LINK tokens or so, would potentially work, as you can see in my case, my subscription was having around 70 LINK tokens. You can easily get 250 LINK tokens from the Chainlink Faucet. Commented Nov 8 at 10:10
  • 1
    To avoid this kind of situation, I usually test on Avalanche Fuji network, as it works with lesser number of LINK tokens too, potentially due to the lower gas fees and lesser chances of gas spikes. Commented Nov 8 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.