Cyfrin / foundry-smart-contract-lottery-cu

48 stars 42 forks source link

Subscription ID too large? #48

Closed MorningLit closed 6 months ago

MorningLit commented 6 months ago

image Currently following part 24 of the lottery smart contract series, and can't seem to fit my subscription id into uint64 https://www.youtube.com/watch?v=DgPYEyiE8NQ&list=PL2-Nvp2Kn0FPH2xU3IbKrrkae-VVXs1vk&index=132

MorningLit commented 6 months ago

My subscription id is 58702003961984393061086325485375073005356194632241668487883182282754836008638 on the sepolia chain

PatrickAlphaC commented 6 months ago

Can you create a screenshot of how you got that number? That' shouldn't be possible for your id to be that large.

MorningLit commented 6 months ago

image I clicked on the clipboard icon on id and it also shows up in the URL

I've checked your video and it also looks to be that way I think image

And thanks for replying so quickly Patrick!

MorningLit commented 6 months ago

Managed to solve this by programmatically running the CreateSubscription script Patrick created in this video https://www.youtube.com/watch?v=oLvQR5FNCu0&list=PL2-Nvp2Kn0FPH2xU3IbKrrkae-VVXs1vk&index=128

Not sure why trying to create a subscription in the UI would result in a very long ID 🤔 eg: https://vrf.chain.link/sepolia/29705503198910972370636457615343113706079550398650684013578130209810340992079 https://vrf.chain.link/sepolia/58702003961984393061086325485375073005356194632241668487883182282754836008638

MorningLit commented 6 months ago

Oh, found out the reason why there is the very large integer, it's because in version 2.5 of chainlink VRF, they increased the size from uint64 to uint256 Related docs here: https://docs.chain.link/vrf/v2-5/migration-from-v2

PatrickAlphaC commented 6 months ago

I see... Thanks for this!

cromewar commented 6 months ago

The update was referred directly on the code: https://github.com/Cyfrin/foundry-smart-contract-lottery-f23/blob/d106fe245e0e44239dae2479b63545351ed1236a/src/Raffle.sol#L54

We also added a note on the written lesson on Updraft stating this update. Thanks a lot, @MorningLit and @PatrickAlphaC