Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Valid

wrong offerId used in `PreMarkets::createOffer` to update offerInfo and stockInfo

Summary

PreMarkets::createOffer updates the offerId before updating the offerInfo and stockInfo , as a result there's a mismatch between the offerId used to generate the offerAddr and stockAddr and the id referenced by the offerInfo and stockInfo

Vulnerability Details

As we can see from the code snippet here , the offerId at the time of updating the offerInfo and stockInfo has already been incremented by 1 and is actually the id of the used for the next Offer or Taker.

Impact

LOW/INFO - Id for the Maker offers is not used outside of PreMarkets::createOffer

Tools Used

Manual Review

Recommendations

offerId shoud be updated after the offerInfo and stockInfo are updated

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-PreMarkets-createOffer-offerId-increment-after

I believe this is valid low severity, although there is inconsistency here when using the correct `offerId` for assigning offerIds and generating the unique addresses as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L67-L69), this is purely an accounting error for offerIds. If we generate the offerId using current `offerId - 1`, the appropriate listing/taker orders can still be created against those offers.

Support

FAQs

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