The _handleWethRewardDistribution
function contains a critical flaw in the way WETH rewards are distributed between protocol and vault fee recipients. The calculation directly multiplies the received WETH with the total fee shares without normalizing them, leading to incorrect distribution. This could result in over- or under-compensation of protocol or vaults, causing financial discrepancies.
In the reward distribution mechanism, the function aims to split the received WETH between the protocol and vaults based on predefined shares. However, the calculations do not normalize the shares relative to a total (e.g., 100% or Constants.MAX_SHARES
). Instead, the raw shares are applied, leading to potential over-allocation when combined.
Issue: The sum of receivedProtocolWethRewardX18
and receivedVaultsWethRewardX18
may exceed or not equal receivedWethX18
due to lack of normalization.
Expected behavior: The sum should always equal receivedWethX18
.
Inputs:
receivedWethX18 = 100e18
feeRecipientsSharesX18 = 0.6e18
(intended as 60%)
Constants.MAX_SHARES = 1e18
(representing 100%)
Expected values:
Protocol: 60 WETH
Vaults: 40 WETH
Actual values:
The values are significantly larger than expected due to improper scaling with UD60x18 fixed-point math.
Test:
This demonstrates that the sum of rewards exceeds receivedWeth
, confirming incorrect calculations.
Vaults or protocol could receive more or less than their fair share of rewards, leading to financial imbalances.
Manual review.
Normalize the shares to a percentage of Constants.MAX_SHARES
:
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.