Shambolic Opaque Swift
Medium
The absence of a check ensuring minVotesToBuy <= maxVotesToBuy
in buyVotes
can lead to confusion or unexpected behavior for users, as the function does not validate these parameters, potentially allowing contradictory inputs.
In ReputationMarket.sol#L440C1-L450C1, buyVotes
accepts maxVotesToBuy
and minVotesToBuy
as parameters, but never checks that minVotesToBuy <= maxVotesToBuy
. This gap can produce conflicting instructions and unexpected user experience.
- The user calls
buyVotes
with parametersmaxVotesToBuy
andminVotesToBuy
whereminVotesToBuy
is greater thanmaxVotesToBuy
or otherwise illogical. - No internal checks enforce consistency between these two parameters.
No response
- A user mistakenly calls
buyVotes(profileId, true, 5, 10)
, implying a desire to buy at least 10 votes but no more than 5. - The function checks only if the user can afford
minVotesToBuy
and attempts to purchasemaxVotesToBuy
— leading to contradictory states or user confusion. - Because no explicit requirement ensures
minVotesToBuy <= maxVotesToBuy
, the input can pass silently, producing undefined or confusing results.
Users could have a confusing or misleading experience, expecting at least a certain minimum but capping at a smaller maximum. While this might not directly cause financial loss, it risks incorrectly handled orders or user frustration, potentially leading to a breakdown of market trust.
No response
- Add Parameter Validation: In
buyVotes
, revert ifminVotesToBuy > maxVotesToBuy
.