Closed c4-bot-7 closed 3 months ago
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as primary issue
That's the intended design discouraging the formulation of invalid proposals.
hansfriese marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/RedemptionFacet.sol#L204
Vulnerability details
Impact
When a redeemer submits proposals for redemption, they are charged a
redemptionFee
based on the total collateralRedemptionFacet#L204
summed across all theshortRecords
proposals (p.totalColRedeemed
andp.totalAmountProposed
):The issue arises when there are effective disputes, as the total amounts of collateral decrease since this collateral is returned to the
shortRecord
(RedemptionFacet#L267-L268
):Consequently, the
redemptionFee
paid by the redeemer would be higher when there are effective disputes. If the redeemer is already paying a penalty, it would be appropriate to refund the fee for theshortRecords
proposals that will no longer be processed due to an effective dispute.Proof of Concept
Consider the following scenario:
UserA
submits proposalsshortRecordsId
1
and3
, totaling a collateral to receive, for example,10 ETH
(5 ETH collateral for each proposal). Based on this number, the corresponding fee is calculated using the functioncalculateRedemptionFee(asset, p.totalColRedeemed, p.totalAmountProposed);
shortRecordId=2
for dispute, and it is correct, causingshortRecordId=3
to be removed fromUserA's slate
, leaving onlyshortRecordId=1
. This results in the redeemer receiving only5 ETH
as collateral forshortRecordId=1
.UserA
callsclaimRedemption
, receiving only5 ETH
as collateral.In the end, the user paid a
redemptionFee
as if they were going to receive10 ETH
, but ultimately only received5 ETH
. The redeemer is paying excess fees.Tools used
Manual review
Recommended Mitigation Steps
Ensure that the redemption fee calculation accounts for effective disputes, adjusting the fee accordingly to prevent overcharging redeemer when disputes occur. If a redeemer is already paying a penalty, consider refunding the fee for the proposals that will not be processed due to an effective dispute. This adjustment will ensure fairness and transparency in the redemption process.
Assessed type
Context