Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

Unfair "Leftover" Handling in `_handleWethRewardDistribution` in `FeeDistributionBranch`

Description:
_handleWethRewardDistribution in FeeDistributionBranch, and distributeProtocolAssetReward in MarketMakingEngineConfiguration.sol uses the distribution logic. The current logic of simply adding this leftover to receivedVaultsWethRewardX18 is incorrect and exacerbates the unfairness introduced by the rounding compensation in distributeProtocolAssetReward.
In _handleWethRewardDistribution, the leftover is added to receivedVaultsWethRewardX18:

UD60x18 leftover = receivedWethX18.sub(receivedProtocolWethRewardX18).sub(receivedVaultsWethRewardX18);
receivedVaultsWethRewardX18 = receivedVaultsWethRewardX18.add(leftover);

This means that the leftover is given to vaults, which are already favored by the rounding compensation in distributeProtocolAssetReward. This further exacerbates the unfairness introduced by the rounding compensation in distributeProtocolAssetReward.
The two unfair effects this causes are:

  1. Protocol recipients lose precision from initial division

  2. Vaults gain these lost amounts, violating intended share ratios

impact:
It means that not only is the last protocol fee recipient unfairly favored within protocol fee distribution, but also vaults are further favored at the expense of protocol fee recipients overall because the "leftover" (caused by under-distribution to protocol recipients due to integer division) is then given to vaults. This is a double-unfairness issue that can lead to significant discrepancies in reward allocation over time, especially if there are many fee recipients and frequent distributions.

Proof of Concept:

Recomended Mitigation:

  1. Remove Vault-Side Leftover Assignment

UD60x18 leftover = receivedWethX18.sub(...);
receivedVaultsWethRewardX18 = receivedVaultsWethRewardX18.add(leftover);
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.