Open hats-bug-reporter[bot] opened 5 months ago
Github username: @kristiyanmaslarov Twitter username: MaslarovK Submission hash (on-chain): 0xdaa74e5894e648c8949977b3863df92ac248d34600c2d060cddeb8c694f99ede Severity: low
Description: Description\ In the verifyRebalance function, there is an if statement, which checks if the swap cost has been exceeded:
verifyRebalance
if (predictedGainAtOffsetEnd <= convertUintToInt(valueStats.swapCost)) revert SwapCostExceeded();
But the check should be exclusive of the predictedGainAtOffsetEnd as this is the limit and the cost would be exceeded after it.
predictedGainAtOffsetEnd
Attack Scenario\ Describe how the vulnerability can be exploited.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
To mitigate this issue please change the code as follows:
if (predictedGainAtOffsetEnd < convertUintToInt(valueStats.swapCost)) revert SwapCostExceeded();
When the predicted gain and the cost are the same, there is no incremental value gain on this trade, we have no reason to do it. This is why it is <=
Github username: @kristiyanmaslarov Twitter username: MaslarovK Submission hash (on-chain): 0xdaa74e5894e648c8949977b3863df92ac248d34600c2d060cddeb8c694f99ede Severity: low
Description: Description\ In the
verifyRebalance
function, there is an if statement, which checks if the swap cost has been exceeded:But the check should be exclusive of the
predictedGainAtOffsetEnd
as this is the limit and the cost would be exceeded after it.Attack Scenario\ Describe how the vulnerability can be exploited.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
To mitigate this issue please change the code as follows: