Search code examples
unit-testingsoliditytrufflechainlink

Trouble Obtaining Random Number: "success" Property in "RandomWordsFulfilled" Event Returns False


Issue Description:

I'm encountering difficulties retrieving a random number using the VRF Direct Funding method in my Truffle framework project with pragma solidity ^0.8.9. During unit testing on a local Ganache network, I've followed the Chainlink docs meticulously. However, the "success" property in the "RandomWordsFulfilled" event consistently returns false. I suspect a potential gas-related issue, particularly in the following code snippet:

(bool success, ) = _consumer.call{gas: req.callbackGasLimit}(callReq);

Additional Information:

  • Pragma: solidity ^0.8.9
  • Testing Environment: Ganache local network
  • Chainlink Docs Followed: Yes
  • Gas-Related Suspicions: Yes

Any insights or suggestions on resolving this issue would be greatly appreciated.

Steps Already Tried:

  1. Remix Environment:

    • Attempted to replicate the issue by following the exact steps in the Remix environment.
    • Ensured the Chainlink VRF contract setup and execution mirrored the local environment.
  2. Local Environment:

    • Replicated the scenario on the local environment, aiming to identify any differences between Remix and the local setup.
    • Examined gas-related configurations to address potential issues.
  3. Gas Adjustment:

    • Experimented with gas settings to troubleshoot the issue.
    • Acknowledged uncertainty about the correctness of gas adjustments.

Request for Assistance:

Despite replicating the steps in both Remix and the local environment and attempting gas adjustments, the problem persists. Seeking guidance on the correct gas configurations or any additional troubleshooting steps to resolve the issue.


Solution

  • Ok so the problem was between the laptop and the chair, I was calling the wrong consumer address, it was the wrapper address not the contract who consumes vrf