The highest standard prize tier is the most common prize: occurring every single draw.
The canary tier has odds of occurring daily (as if it were the highest tier)
Therefore, both the highest standard tier and the canary tier should have odds of 1, however at the moment only the canary tier has odds of 1. The result is that the protocol is not distributing prizes as intended.
Proof of Concept
The issue with the odds calculations can be seen in the TieredLiquidityDistributor.sol contract. Below is a short snippet for the tier odds when there are 3 tiers:
The canary tier odds are 1 as intended, however the highest normal prize tier odds are incorrect. If the tier odds were being calculated correctly, we should see the last two odds for each number of tiers being 1 (i.e. 1000000000000000000).
Tools Used
Manual review
Recommended Mitigation Steps
Since the TierCalculationLib.getTierOdds only seems to be used by the GenerateConstants script, I suggest modifying the script used to generate the constants that are placed in TieredLiquidityDistributor.sol:
Lines of code
https://github.com/GenerationSoftware/pt-v5-prize-pool/blob/4bc8a12b857856828c018510b5500d722b79ca3a/src/abstract/TieredLiquidityDistributor.sol#L83-L200
Vulnerability details
Impact
The following points are stated in the docs:
Therefore, both the highest standard tier and the canary tier should have odds of 1, however at the moment only the canary tier has odds of 1. The result is that the protocol is not distributing prizes as intended.
Proof of Concept
The issue with the odds calculations can be seen in the
TieredLiquidityDistributor.sol
contract. Below is a short snippet for the tier odds when there are 3 tiers:The canary tier odds are 1 as intended, however the highest normal prize tier odds are incorrect. If the tier odds were being calculated correctly, we should see the last two odds for each number of tiers being 1 (i.e.
1000000000000000000
).Tools Used
Manual review
Recommended Mitigation Steps
Since the
TierCalculationLib.getTierOdds
only seems to be used by theGenerateConstants
script, I suggest modifying the script used to generate the constants that are placed inTieredLiquidityDistributor.sol
:Assessed type
Math