An incorrect offerId
is assigned to the PreMarkets:stockInfoMap
and PreMarkets:offerInfoMap
, leading to a mismatch between the offer identifiers used to generate addresses and the identifiers stored in these mappings.
The PreMarkets:createOffer
function is responsible for creating an offer by generating addresses for makerInfoMap
, offerInfoMap
, and stockInfoMap
, each associated with an offerId
. The addresses are created as follows:
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L67-L69
As the execution proceeds, the offerId
is incremented:
After this increment, the mappings makerInfoMap
, offerInfoMap
, and stockInfoMap
are fetched using the previously generated addresses makerAddr
, offerAddr
, and stockAddr
. However, the id
fields in the offerInfoMap
and stockInfoMap
structs are set to the new, incremented offerId
, which differs from the offerId
initially used to generate the addresses.
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L116-L146
This results in a misalignment between the offerId
used to create the addresses and the offerId
stored in the mappings, potentially causing inconsistencies and errors in the offer-related data.
Misalignment between the offerId
used to create the addresses and the offerId
stored in the mappings
Manually
Use correct offerId
update it later
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.