The protocol is able to modify the collateralLiquidationPriority set to re-order the collateral addresses that will be collected first during liquidation.
It is done through the GlobalConfigurationBranch::configureCollateralLiquidationPriority() function which adds the provided collateral address at the end of the set.
In case one of the collaterals that are trying to be added to the set already exists, the transaction will revert.
In case the whole collateral liquidation priority has to be changed, the current implementation doesn't offer enough flexibility to do it in a single transaction, can be quite a burden to reorder and could cause unexpected behaviors including accounting errors.
The protocol admins would have to remove all the collaterals one by one, executing GlobalConfigurationBranch::removeCollateralFromLiquidationPriority() multiple times to remove them from the collateralLiquidationPriority set before pushing them back in the new order with GlobalConfigurationBranch::configureCollateralLiquidationPriority()
During the multiple executions of removeCollateralFromLiquidationPriority() the protocol doesn't stop operating and liquidations must occur which collects collateral based upon the collateralLiquidationPriority that is temporarly unstable and unreliable.
Some accounts could be liquidated and their collateral being collected in an unexpected order leading to user being more exposed to the volatility of his collateral basket.
Liquidations can occur in an unexpected manner resulting in funds being stuck in the contract and fees not collected.
The following coded PoC demonstrates an issue where a liquidation occurs during a collateral priority reordering and results in fees not being collected by the respective recipients (ending up stuck in the contract) as well as an accounting error in the trader's account.
The test can be pasted in test\integration\perpetuals\liquidation-branch\liquidateAccounts\liquidateAccounts.t.sol
Make sure to import
UD60x18andSD59x18if needed
Manual review
Implement a function that is responsible for re-ordering the collateralLiquidationPriority storage in a single transaction or re-implement configureCollateralLiquidationPriority() to allow a more flexible re-ordering.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.