Lack of explicit asset
validation
Description
There is no explicit check for the asset
parameter in the postFillOrder
, postFillCloseOrder
, postLimitOrder
, and cancel
functions to ensure that a market exists for the specified asset.
Although using an asset
parameter corresponding to a nonexistent market causes these functions to revert, it is preferable to detect this condition earlier and revert with a dedicated error message.
Impact
The error messages emitted by these functions when an asset
parameter corresponding to a nonexistent market is used may not clearly indicate that a market has not been created for the specified asset.
Recommendations
We recommend adding an explicit sanity check for the asset
parameter at the beginning of these functions to ensure that a market has been created for the specified asset.