smartcontractkit / smartcontractkit/chainlink

[SMRT] SubscriptionId in VRF and Automations

Open
#13,099 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
8.2k
Forks
2k
Avg merge
1d 23h
Merged PRs (30d)
202

Description

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"
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the VRFCoordinatorV2Interface and VRFCoordinatorV2Mock definitions, then inspect requestRandomWords and addConsumer alongside the @chainlink/contracts ^1.1.0 dependency. Reproduce the ethers out-of-bounds error with the oversized subscriptionId and compare the interface types with the Chainlink VRF usage; done when the expected identifier type and affected contract interfaces are consistently established.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.