The OrderBook contract contains a redundant id field in the Order struct that duplicates information already available as the mapping key. The field is set during order creation but serves no functional purpose, as the order ID is already accessible through the orders mapping key and function parameters.
The redundant field appears in the struct definition:
The field is populated during order creation but only used once in the getOrderDetailsString() function, where it could easily be replaced with the _orderId parameter that's already available.
Each order creation consumes an additional ~20,000 gas for the unnecessary SSTORE operation
Each order consumes an extra 32 bytes of contract storage
Maintains duplicate data that serves no functional purpose
With frequent order creation, these gas costs accumulate significantly, making the protocol less cost-efficient for users.
Remove the id field from the Order struct:
Update the getOrderDetailsString() function to use the parameter instead:
Remove the id assignment from order creation in createSellOrder().
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.