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

Enforce minimum distance between last price sample and `SellRewards` #549

Closed ruuda closed 2 years ago

ruuda commented 2 years ago

Addresses https://github.com/ChorusOne/solido/pull/511/files#r839805004. Without this, you can put the final fetch in the same transaction as the sale, and sandwich the final sale by sandwiching two additional fetches (so you control 3 of the 5 price samples, so you control the median). With this added check, you need to sandwich one additional fetch before you can sandwich the final sale.

enriquefynn commented 2 years ago

Just one Nit: we need to add:

wait_for_slots(100)

in tests/test_anker.py just after we finish updating the pool price.

ruuda commented 2 years ago

Good find, added, and I also confirmed that the test failed previously and passes now.