ContestManager::getContestTotalRewards does not check that param address contract is an approved contest, which returns a uint256 instead of revertingContestManager::getContestTotalRewards does not check that param address contract is an approved contest, returning the default of uint256 which is 0, instead of reverting. This means that the information introduced into the protocol is not precise. The logic currently puts contests in array ContestManager::contests, which could be checked, although we recommend the use of a mapping to do this check. See mitigation section.
Likelihood:
This happens any time a non-approved address is passed to ContestManager::getContestTotalRewards.
Impact:
The impact is that a given address is not checked as a valid contest, which means that the default value of uint256 is returned when the address is passed to mapping ContestManager::contestToTotalRewards instead of this function reverting. This introduces uncertainty into the protocol, because now it appears that the address might be a legitimate contest, but that it has no rewards remaining.
We define a fake contract DummyContract in the test file test/TestMyCut.t.sol.
In our test, we deploy a contract fakePot based on DummyContract, and we pass the address of fakePot to ContestManager::contestToTotalRewards. Instead of reverting, the function returns the default value of uint256 in the mapping, which is 0. This test function passes.
We recommend that a mapping of addresses to booleans be created to define if an address is a contest in ContestManager.
The mapping will allow for constant-time look-up to verify that a given address is a contest. This mapping can be updated in ContestManager::createContest:
We recommend that a custom error be added to ContestManager:
We recommend that the mapping be checked, and if the check does not return true, the custom error be thrown.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.