In contract, there is a potential issue related to the definition of the DUST_AMOUNT
. This value is used in the emergencyWithdraw
function to avoid leaving small amounts of assets behind during withdrawals. However, the specific context and definition of this value are not provided, making it unclear whether the value of 1e17
is appropriate. This vulnerability highlights the need for a review of the code to ensure that the dust amount is correctly defined for the system's context.
In the emergencyWithdraw
function, the code checks if the calculated user share balance minus the amount to be withdrawn is less than the DUST_AMOUNT
. If this condition is met, the code ensures that the full user share balance is withdrawn, preventing dust amounts from remaining in the contract. The specific value of DUST_AMOUNT
is set as 1e17
, but there is no context or explanation regarding how this value was determined or whether it is suitable for the system.
The impact of this vulnerability could result in small amounts of assets, often referred to as "dust," getting stuck in the contract. This can lead to an accumulation of negligible assets over time, potentially affecting the efficiency and cleanliness of the contract.
VsCode
Review and assess the specific context and requirements of the system to determine an appropriate value for DUST_AMOUNT
. This value should be set to a level that prevents dust accumulation without inadvertently affecting legitimate withdrawals.
Document the rationale and context behind the chosen DUST_AMOUNT
value, both in the code comments and in the project's documentation.
Consider incorporating a mechanism to sweep and clean dust amounts periodically if they do accumulate to ensure the efficient operation of the contract. This could be part of a maintenance function or routine.
Recommendation Example
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.