Oct 1, 2024 - Lottery Delay
What happened
Lottery was delayed for 8 hours. We are growing such that our current system is struggling. I made changes a few days ago which caused a problem last night. I’m making fixes so this doesn’t happen again. Thanks for sticking with us as we scale up this system.
I take the blame for any issue with the lottery and I know I need to continue earning your trust. I’ll make changes so this never happens again. I will also be on hand every day for the next few days to provide a faster response time in case things happen.
How do I know this lottery is secure?
Running the lottery is a two-step process.
We call Pyth Entropy to generate a random number for this specific lottery run. generates a random number for us. See transaction.
We call Pyth Entropy to submit the already generated random number to our lottery contract. See transaction. When I say I “manually run” the lottery, I call Pyth Entropy and provide enough gas so that the contract can submit the random number. I do not know this number ahead of time, nor can I change this number.
The lottery contract is designed to not allow anyone to tamper with it. Once the first step has run, the contract is locked to only allow the second step to finish running the lottery.
As a lottery, security is of utmost importance. This contract is public and verified, is audited, and has not had any hack since launching over 2 months ago.
It is the same as the ETH lottery, which has been won 5 times. However, the jackpot is so much bigger so it’s much more unlikely for individual players to win (~1 in 150k chance).
Problem in technical detail
We tried to fetch the random number from Pyth Entropy, but the block had not been confirmed yet. Thus, it did not have the random number yet.
This error occured because 3 days ago, I reduced the time steps 1 and 2 above, from 5 seconds to 2 seconds. I did this because our server tries to run the lottery every minute and allocates one minute to run the lottery. In the past, this had a timeout issue, so I reduced that time in an effort to keep us within that 1 minute.
Separately, our server is handling increased ticket volume and is also running the ANDY lottery too as of Sept 25.
Moving forward, I made multiple changes to ensure this does not happen again:
Extended cron job timeout to 5 min, fetching lottery run receipt by 30 seconds
Reduce concurrency issues - running cron job every 2 min instead of 1 min
Updated contract’s `roundDurationInSeconds` to be 23h 58m so it shouldn’t move back by a few min every day
Last updated