Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: medium
Invalid

Incorrect Round Comparison in relist Function

Summary

The relist function in the Swan contract contains a logical error in the round comparison, which prevents sellers from relisting their assets. The issue arises from using the <= operator instead of == when checking if the current round has ended.

Vulnerability Details

https://github.com/Cyfrin/2024-10-swan-dria/blob/c8686b199daadcef3161980022e12b66a5304f8e/contracts/swan/Swan.sol#L215

https://github.com/Cyfrin/2024-10-swan-dria/blob/c8686b199daadcef3161980022e12b66a5304f8e/contracts/swan/Swan.sol#L218

The code uses <= to compare the current round with the asset's listing round. This prevents relisting because the condition oldRound <= asset.round is always true when the rounds are equal, blocking the relisting process.The comparison should use == to ensure that relisting is only blocked if the current round is still ongoing (i.e., the rounds are equal).

if (oldRound <= asset.round) {
revert RoundNotFinished(_asset, asset.round);
}

Impact

Sellers are unable to relist their assets once the current round has ended, potentially leading to loss of sales opportunities.

Tools Used

Manual Review

Recommendations

Change the comparison operator from <= to == on line 218 to correctly check if the current round is still ongoing.

if (oldRound == asset.round) {
revert RoundNotFinished(_asset, asset.round);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.