Open hats-bug-reporter[bot] opened 1 month ago
Yeah, the code did reserve the last 3 slots, but even type(uint256).max - 2
is way too high to make any sense (we'd end up around 1E77 and dividing by that would lead to 0, and a market with a maximum value of 1E77 would be obviously wrong and not pass curation).
As per contest rules are excluded:
Hey @clesaege, thank you for your reply. It is up to users' creativity and foresight when they create a market, as they may envision outcomes and values that make sense within their specific context. For instance, while type(uint256).max - 2 may seem excessively high in many cases, there are potential scenarios where such a high value could be relevant.
One example could be predicting the number of observable planets by the end of 2030. Given that this number isn't finite and considering that technological advancements could drastically improve our observation capabilities in the coming years, the rate at which we discover new planets could increase exponentially. Under these circumstances, a value around 1E77 could be feasible.
Another potential example can be a market predicting the maximum storage capacity of a single computer chip. Technology has been advancing rapidly and future advancements could significantly increase the limits.
Under these circumstances, a value around 1E77 is feasible.
Such a high value would be likely to cause issues in other part of the code and here being able to set a max value to 115792089237316195423570985008687907853269984665640564039457584007913129639933 instead of 115792089237316195423570985008687907853269984665640564039457584007913129639932 would provide little interest.
Github username: -- Twitter username: -- Submission hash (on-chain): 0xa12d42f476f20830a264cbc23a927d34e2ef13fd1e0364ee588147dbb15ca3be Severity: low
Description: Description
The function
createScalarMarket
is responsible for creating a scalar market and contains a boundary check on theupperBound
parameter, with the intention of ensuring it does not conflict with reserved values in the system. The check enforces thatupperBound
must be strictly less thantype(uint256).max - 2
. However, the accompanying comment indicates thatReality
reserves values forINVALID
andUNRESOLVED_ANSWER
, suggesting that the maximum allowed value should betype(uint256).max - 3
. This inconsistency between the condition and the comment creates ambiguity regarding the intended constraint. If the check aims to exclude only the last two reserved values, the condition should allow for equality (<=
). Alternatively, if the current condition is correct, the comment should be updated to reflect that the maximum allowable value is three units less thanuint256.max
. This ambiguity could lead to misunderstandings or incorrect assumptions during further development or use of the contract.Attachments
Review the logic and intention behind the boundary check on
upperBound
to ensure clarity and consistency. Either update the comment to accurately describe the enforced constraint or adjust the condition to align with the comment. This will improve code readability and prevent potential misinterpretations of the boundary restrictions for scalar market creation.