superfluid-finance / superfluid-sentinel

MIT License
24 stars 13 forks source link

[BUG] false positive can block other liquidations and drain the sentinel if using BatchLiquidator #302

Closed d10r closed 8 months ago

d10r commented 8 months ago

What

On 2024-03-24, a sentinel for polygon-mainnet ran into a condition causing its funds to be drained. It saw a flow to be liquidated which didn't exist anymore. Trying to delete it using the BatchLiquidator, it tried again and again, draining all its funds. Example tx: https://polygonscan.com/tx/0x263d483d772dcff37bcaf8cf7b610c827bd529df2468d5334d5ce9bffed5e46c tenderly: https://dashboard.tenderly.co/tx/polygon/0x263d483d772dcff37bcaf8cf7b610c827bd529df2468d5334d5ce9bffed5e46c/debugger?trace=0.9.0.1.0.0.4.1.0.1.0.3

image

If disabling the BatchLiquidator, the sentinel kept printing an error msg, but stopped making transactions:

Mar 24 18:41:10 mainnet-sentinels nvm-exec[1833400]: 2024-03-24T18:41:10.882Z - error: Liquidator.sendWithRetry: BaseError: error happened while trying to execute a function inside a smart contract
Mar 24 18:41:11 mainnet-sentinels nvm-exec[1833400]: 2024-03-24T18:41:11.966Z - error: Liquidator.sendWithRetry: BaseError: error happened while trying to execute a function inside a smart contract

AC

ngmachado commented 8 months ago

Ty for the report.

The code has a protection against non running streams that are in liquidation queue. This is a bug, probably a regression one. I need to dig more on the issue itself and gather some data before a fix.