In the PreMarkets::createOffer function, the PreMarkets::offerId variable is used when generating the address for Stock. However, when saving StockInfo, the value of the id field is assigned to PreMarkets::offerId + 1. In the PreMarkets::createTaker function, the PreMarkets::offerId variable is used for both generating the address for Stock and saving StockInfo,
PreMarkets::createOffer
PreMarkets::createTaker
This is not considered best practice and can introduce potential vulnerabilities when using StockInfo::id to regenerate an address.
Add the following test case into the file PreMarkets.t.sol
Update PreMarkets::offerId before generating new address for Stock or after saving the StockInfo. This ensures that the value of the id field in StockInfo corresponds with the value of the PreMarkets::offerId variable used to generate the address for Stock.
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.