In Turbo mode, the initial offer maker is responsible for settling all subsequent trades that stem from their ASK offer. Consequently, the maker should be prevented from canceling the ASK offer if there are any subsequent listings based on the stock originally acquired from it. Permitting the maker to abort the ASK offer under these circumstances would disrupt the continuity of trades, potentially leaving transactions unsettled. However, the current implementation fails to correctly track whether the initial offer has such subsequent listings, leading to potential disruptions in the trading process.
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L342
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L552
Line #342 in listOffer() function inside PreMarkets.sol is intended to change the abortOfferStatus of the initial offer and this variable is later checked in on line #552 in abortAskOffer() in the same file. |
Saving OfferInfo in memory with OfferInfo memory originOfferInfo = offerInfoMap[originOffer]; and then modifying it with originOfferInfo.abortOfferStatus = AbortOfferStatus.SubOfferListed; only updates the local memory copy, not the original data in offerInfoMap. This leads to an inconsistent state, as the changes do not persist in the contract's storage.
The following test shows a scenario, where initial Maker can abort the offer after subsequent listing.
While this issue does not cause direct financial losses for the protocol or its users, it can indirectly harm potential traders who may be unable to purchase the points they intended. This could lead to missed opportunities.
Manual review, Foundry.
Update the abortOfferStatus directly in the offerInfoMap storage rather than in memory.
OfferInfo storage originOfferInfo = offerInfoMap[originOffer];
Valid high severity, because the `abortOfferStatus` of the offer is not updated and persist through `storage` when listing an offer for turbo mode within the `offerInfoMap` mapping, it allows premature abortion given the `abortOfferStatus` defaults to `Initialized`, allowing the bypass of this [check](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L552-L557) here and allow complete refund of initial collateral + stealing of trade tax which can potentially be gamed for profits using multiple addresses
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.