There is a discrepancy in the order of burning unripe tokens and calculating their underlying value between the UnripeFacet::chop and ConvertFacet::convert functions.This inconsistency can lead to different redemption values
for the same transaction parameters
.
UnripeFacet::chop
Function: This function burns the unripe tokens first and then calculates the underlying amount to redeem. The total supply of unripe tokens is reduced before calculating the underlying amount, which affects the calculation.
ConvertFacet::convert
Function: This function calls LibChopConvert.convertUnripeToRipe
, which first calculates the underlying amount and then burns the unripe tokens. The total supply remains unchanged during the calculation, resulting in a different underlying amount being determined.
In the chop
Function: The unripe tokens are burned first, and then the underlying amount is calculated. The total supply of unripe tokens is reduced before calculating the underlying amount, which affects the calculation.
In the ConvertFacet::convert
Function: In this function, LibChopConvert.convertUnripeToRipe
is called via convertData
param, which first calculates the underlying amount and then burns the unripe tokens. The total supply remains
unchanged during the calculation, resulting in a different underlying amount being determined.
So, the kind is equal to LibConvertData.ConvertKind.UNRIPE_TO_RIPE
.
Here, the actual conversion from unripe to ripe occurs, but it calculates the underlying amount before burning the unripe tokens
This is a critical inconsistency in the chop
and convert
functions related to the order of burning unripe tokens and calculating the underlying amount. This can lead to different redemption values.
The calulation of the redeem value if the supply is change LibChop.chop() -->> LibUnripe::getPenalizedUnderlying()
The calulation of the redeem value.
Impact on the value of redeem:
UnripeToken is not burned: redeem = 100 * 50 / 100 * 1 / 100 = 0.5
UnripeToken is burned: redeem = 100 * 50 / 100 * 1 / 99 = 0.505
The different order of operations can lead to inconsistent and miscalculations of the underlying amount to be redeemed, resulting in underlying amount discrepancies. An attacker could exploit this inconsistency to manipulate the amount of ripe tokens they receive.
chop
Function: Results in a lower underlying amount due to reduced total supply after burning.
convertUnripeToRipe
Function: Results in a higher underlying amount as the total supply used in calculations does not account for the burned tokens.
if redeem value is > then underlyingAmount this will cause a significant difference
Manual Review
Calculate the underlying amount first, then burn the tokens, and use the initial total supply for calculation in both cases.
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.