https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L39-L157
offerId stored in offerInfoMap and stockInfoMap is 1 more than orderId used to generate the respective addresses. This can cause incorrect orders or stocks to be matched when calling any of PreMarkets::createTaker, PreMarkets::listOffer, PreMarkets::closeOffer, PreMarkets::relistOffer, PreMarkets::abortAskOffer, PreMarkets::abortBidTaker, PreMarkets::settledAskOffer and PreMarkets::settleAskTaker functions.
Here as it can be seen in PreMarkets::createOffer function, firstly the orderId is used to generate an address by using the keccak256 hash, and then increased.
Likelihood: High
Impact: Med/High - This would cause inconsistencies in offerIds while interacting with the protocol
Overall severity is High.
Manual Review
Update offerId before generating the addresses
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.
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.