ChorusOne / solido

Lido for Solana is a Lido-DAO governed liquid staking protocol for the Solana blockchain.
https://chorusone.github.io/solido/
GNU General Public License v3.0
101 stars 43 forks source link

Fix overflow in APY daemon discovered by fuzzer #555

Closed ruuda closed 2 years ago

ruuda commented 2 years ago

In case of a very high epoch number, the computation for start_slot + QUERY_SLOT_OFFSET could overflow. This will not occur in practice, and it’s not triggered by a user input. It could only be triggered by a malicious RPC node. Still, we should fix it, if only to unblock the fuzzer for finding other issues.

enriquefynn commented 2 years ago

Hum... I wonder if we should start fixing such edge-cases. Of course a malicious RPC node could answer bogus data, but a malicious RPC node also has opportunity to mess with the system in a lot of levels. At a normal conditions, epoch is overflow will happen in billion of years, a time in which I hope there's something better than Solana out there 🙈

ruuda commented 2 years ago

Hum... I wonder if we should start fixing such edge-cases.

Yes, we should still fix it, even if this is not a problem in practice, for a few reasons: