BriVault::_getWinnerShares, can lead to function reverting because out of gasWhen a users join the event, their country Id and address are assigned into userSharesToCountrymapping
When the event has ended, the owner can call setWinner function, this function then call _getWinnerShares
_getWinnerSharesreturn the totalWinnerShares
inside _getWinnerShares it increments userSharesToCountrymapping using a for loop, this is effective for a low number of users, but when there is too many users, looping through this mapping can cost a high number of gas
Owner will pay for a high amount of gas if the protocol has many users
possible for dos (denial of service) attack, if it exceeds mainnet gas limit it will revert, preventing user to withdraw their prize
Likelihood:
Low, we need a massive amount of users to join the tournament
Impact:
High, owner paying for high amount of gas (maybe exceeding the gained fee) and dos attack due to large number of users
Paste this inside the test contract
due to foundry gas limitation, we can only test for 5431 users
The _getWinnerShares() function is intended to iterate through all users and sum their shares for the winning country, returning the total.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.