offerId
is not correctly updated in PreMarkets::createOffer()
When a user creates an offer using createOffer(), then it generates
maker/stock/offer address using offerId
as input. Now the problem is, it updates the offerId before
using it in maker/stock/offer struct, which leads that id
s of the structs are set to the next
offerId ie other than that is used to generate their addresses
Now this will create issue down the line while creating taker or listing offer or again creating offer
//Lets see how this will create issue while creating taker
Suppose a user created offer then stock/maker/offer address will be generated with offerId = 0 but id of all 3 structs will be set to 1(due to early updation of offerId)
Another user created taker for that offer then createTaker() will generate stock address with offerId = 1 & will set id = offerId = 1 in stock struct, then it will increase the offerId = 2. Here problem is we have 2 stock struct which has id = 1(one that was created in step 1 & second in this step 2)
//Here is PoC
Multiple structs with same id will be created
Manual Review
Either update the offerId before generating addresses or after setting all 3 structs in createOffer()
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.