Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SMRT] SubscriptionId in VRF and Automations #13099

Open
ArshilHapani opened this issue May 4, 2024 · 3 comments
Open

[SMRT] SubscriptionId in VRF and Automations #13099

ArshilHapani opened this issue May 4, 2024 · 3 comments

Comments

@ArshilHapani
Copy link

In VRF and Automations contract there is one parameter subscriptionId in requestRandomWords of VRFCoordinatorV2Interface interface and addConsumer function from VRFCoordinatorV2Mock interface.
The issue is that the type of subscriptionId is uint64 but the id provided by chainlink site is way to big
e.g. 15356376269897563744780985323350096414521302577903754215356556594835422566595
Something like this which leads to error

   TypeError: value out-of-bounds (argument="_subId", value="15366376269897563744780985323350096414521302377970374217356556294839422166091", code=INVALID_ARGUMENT, version=6.12.0)
      at makeError (node_modules/ethers/src.ts/utils/errors.ts:687:21)
      at assert (node_modules/ethers/src.ts/utils/errors.ts:715:25)
      at assertArgument (node_modules/ethers/src.ts/utils/errors.ts:727:5)
      at NumberCoder._throwError (node_modules/ethers/src.ts/abi/coders/abstract-coder.ts:350:23)
      at NumberCoder.encode (node_modules/ethers/src.ts/abi/coders/number.ts:47:18)
      at /home/arshli-hapani/arshil/Future Span/Practice Span/web3/hardhat_smart_contract_lottery/hardhat_lottery_contracts/node_modules/ethers/src.ts/abi/coders/array.ts:64:19
      at Array.forEach (<anonymous>)
      at pack (node_modules/ethers/src.ts/abi/coders/array.ts:47:12)
      at TupleCoder.encode (node_modules/ethers/src.ts/abi/coders/tuple.ts:62:20)
      at AbiCoder.encode (node_modules/ethers/src.ts/abi/abi-coder.ts:195:15)

Version

{
  "devDependencies": {
    "@chainlink/contracts": "^1.1.0",
    "@nomicfoundation/hardhat-toolbox": "^5.0.0"
  }
}
@Varadiell
Copy link

Hello, i'm having this issue too! :)
The subId key provided by ChainLink is way too long, as explained by @ArshilHapani
Example here

@psyfluid
Copy link

psyfluid commented May 13, 2024

As far as I understand, you can now only get a subscription ID for VRF v2.5. There is a guide on how to migrate from v2: https://docs.chain.link/vrf/v2-5/migration-from-v2#overview

But there is no mock interface for v2.5 (or I couldn’t find it). So now you have two options:

  1. for the real interface and testnet/mainnet use v2.5 with your subscription ID, and for the local chain use v2 code and a random subscription ID in uint64.
  2. or write your own mock for v2.5.

I think option 1 is easier.

@Varadiell
Copy link

Hi again, I just got an advice from someone, and I managed to create a version 2.0 subscription that has a usable subId with this contract here!
Once you use the "createSubscription", you can check here that your v2.0 subscription has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants