Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: medium
Invalid

Logical Error in abortAskOffer Function Causes Unintended Reverts

Vulnerability Details

The abortAskOffer function in the PreMarkets contract has a logical error that causes it to always revert. The function is supposed to allow the abortion of an offer if its status is either Virgin or Canceled. However, the condition in the function uses the && (AND) operator:

if (offerInfo.offerStatus != OfferStatus.Virgin && offerInfo.offerStatus != OfferStatus.Canceled) {
revert InvalidOfferStatus();
}

which incorrectly checks if the status is not both Virgin and Canceled at the same time. Since an offer can only have one status at a time, this condition always evaluates to true, causing the function to revert, even when the offer is in a valid state for abortion. This issue makes the function unusable and disrupts the intended contract behavior.

Impact

The impact of this issue is significant because it makes the abortAskOffer function unusable. Any attempt to abort an offer will fail, regardless of its status, which could disrupt the normal workflow of the contract. This means that even valid operations, where the offer should be allowed to be aborted, will fail, potentially locking users out of their ability to manage their offers. This could lead to a loss of trust in the contract and a disruption in the expected functionality.

Recommendations

To fix this issue, the logical operation in the if statement should be changed from && to || (OR):

if (offerInfo.offerStatus != OfferStatus.Virgin || offerInfo.offerStatus != OfferStatus.Canceled) {
revert InvalidOfferStatus();
}

This will ensure that the function only reverts when the offerStatus is neither Virgin nor Canceled, allowing the function to work as intended.

Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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