Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Rebalancer manager error with zero debt rebalance #722

Closed 0xdcota closed 8 months ago

0xdcota commented 8 months ago

I noticed that in rebalancing borrowing vaults that only had assets (no debt) the flashloan is not needed. There was a case in where flashloaning zero debt resulted in a "successful" but useless tx that got the Rebalancer locked because it wrote to the entryPoint state but never completed the execution and therefore the Rebalancer is locked from being used again.

The fixes of this PR avoid using flashloan when rebalancing a borrowing vault that only has assets ( or zero debt), and a new function restricted to the timelock is added to unblock the entryPoint variable in case is necessary. The reason why this is restricted to the timelock is to avoid, reentrancies by malicious allowedExecutor users who could figure out ways to by-pass checks of the entryPoint.

Refer to this tx: https://etherscan.io/tx/0x2c593ffbe66ff630794907ce6a5d6f2906bd2e929b69535f9124f2b82e3fffb0

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **fuji-v2-frontend** | ⬜️ Ignored ([Inspect](https://vercel.com/fuji-finance/fuji-v2-frontend/4asu9yyP5PfdjxvQKUR99mvwL7ey)) | [Visit Preview](https://fuji-v2-frontend-git-protocol-fixrebalancer-17e0d6-fuji-finance.vercel.app) | | Aug 19, 2023 5:03pm |