Docile Corduroy Camel
Medium
When checking for a market to be graduated, we use ReputationMarket.sol::_checkMarketExists()
. This way if the market creator has sold his votes, or is the last one to sell his votes, then the market becomes ungraduatable.
function _checkMarketExists(uint256 profileId) private view {
if (markets[profileId].votes[TRUST] == 0 && markets[profileId].votes[DISTRUST] == 0)
revert MarketDoesNotExist(profileId);
}
As there is no check for votes becoming 0 when selling votes this is possible and may happen even unknowingly by users that are not aware of this limitation.
Part of the ReputationMarket.sol::sellVotes()
function:
(uint256 proceedsBeforeFees, uint256 protocolFee, uint256 proceedsAfterFees) = _calculateSell(
markets[profileId],
profileId,
isPositive,
votesToSell
);
uint256 pricePerVote = votesToSell > 0 ? proceedsBeforeFees / votesToSell : 0;
if (pricePerVote < minimumVotePrice) {
revert SellSlippageLimitExceeded(minimumVotePrice, pricePerVote);
}
markets[profileId].votes[isPositive ? TRUST : DISTRUST] -= votesToSell;
votesOwned[msg.sender][profileId].votes[isPositive ? TRUST : DISTRUST] -= votesToSell;
And in the ReputationMarket.sol::_calculateSell()
function we have no check if votes after sell == 0.
Part of the ReputationMarket.sol::_calculateSell()
function:
uint256 votesAvailable = votesOwned[msg.sender][profileId].votes[isPositive ? TRUST : DISTRUST];
if (votesToSell > votesAvailable) revert InsufficientVotesOwned(profileId, msg.sender);
if (market.votes[isPositive ? TRUST : DISTRUST] < votesToSell)
revert InsufficientVotesToSell(profileId);
It is possible for a contract to be left out with 0 votes of TRUST
and DISTRUST
after selling of votes. This will lead to markets that cannot be graduated.
No response
No response
No response
(Griefing of markets/selling by mistake) will lead to many markets that can' be graduated.
No response
No response