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
I am implementing a new version of VRFCoordinator v2.5 in my code and for local testing I am using VRFCoordinatorV2_5Mock contract. Unfortunately, while calling the createSubscription function of this contract (as instructed in the Local testing using a mock subscription contract) I am getting this error;
[⠢] Compiling...
[⠰] Compiling 2 files with 0.8.19
[⠔] Solc 0.8.19 finished in 1.20s
Compiler run successful!
0x4e487b710000000000000000000000000000000000000000000000000000000000000011
Traces:
[4282228] → new DeploySubscriptionVRFV2_5@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
└─ ← [Return] 21276 bytes of code
[6225604] DeploySubscriptionVRFV2_5::run()
├─ [3279821] → new SubscriptionVRF_HelperConfig@0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141
│ └─ ← [Return] 16160 bytes of code
├─ [2909757] SubscriptionVRF_HelperConfig::getConfig()
│ ├─ [0] VM::startBroadcast()
│ │ └─ ← [Return]
│ ├─ [2863541] → new VRFCoordinatorV2_5Mock@0x5FbDB2315678afecb367f032d93F642f64180aa3
│ │ ├─ emit ConfigSet()
│ │ └─ ← [Return] 13951 bytes of code
│ ├─ [2616] VRFCoordinatorV2_5Mock::createSubscription()
│ │ └─ ← [Revert] panic: arithmetic underflow or overflow (0x11)
│ └─ ← [Revert] panic: arithmetic underflow or overflow (0x11)
└─ ← [Revert] panic: arithmetic underflow or overflow (0x11)
After some debugging, I found that the error was caused by the subtraction of blockhash(block.number - 1) in the createSubscription function while generating subId in this contract
This issue has been preview on the Pull Requests. To resolve, Contact the dAppNode page to initiate a chat with the live agent on the chat button to get more information about your request via dAppNode Thank you for posting @alymurtazamemon
Attention! Don't click on this link! It is malicious
I am implementing a new version of VRFCoordinator
v2.5
in my code and for local testing I am usingVRFCoordinatorV2_5Mock
contract. Unfortunately, while calling thecreateSubscription
function of this contract (as instructed in the Local testing using a mock subscription contract) I am getting this error;After some debugging, I found that the error was caused by the subtraction of
blockhash(block.number - 1)
in thecreateSubscription
function while generatingsubId
in this contractI removed the
-1
from this line, and everything started working as expected. The modified line now looks like this:The code may expect
block.number > 1
, but even after mining some blocks before this transaction, the issue persists.Leaving this here so others can see the temporary solution and developers can work on a permanent fix for this issue.
here is the code;
The text was updated successfully, but these errors were encountered: