Part 2

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

Risk in fee share allocation in `configureFeeRecipient()` in the `MarketMakingEngineConfigurationBranch` contract

Summary

The configureFeeRecipient() function allows the protocol to allocate a high fee to itself, breaking economic invariants and disincentivising user participation. The MAX_CONFIGURABLE_PROTOCOL_FEE_SHARES allows the protocol to claim up to the maximum defined value, This can risk system instability.

Vulnerability Details

function configureFeeRecipient(address feeRecipient, uint256 share) external onlyOwner {
// revert if protocolFeeRecipient is set to zero
if (feeRecipient == address(0)) revert Errors.ZeroInput("feeRecipient");
// load market making engine configuration data from storage
MarketMakingEngineConfiguration.Data storage marketMakingEngineConfiguration =
MarketMakingEngineConfiguration.load();
// check if share is greater than zero to verify the total will not exceed the maximum shares
if (share > 0) {
UD60x18 totalFeeRecipientsSharesX18 = ud60x18(marketMakingEngineConfiguration.totalFeeRecipientsShares);
if (
totalFeeRecipientsSharesX18.add(ud60x18(share)).gt(
@> ud60x18(Constants.MAX_CONFIGURABLE_PROTOCOL_FEE_SHARES)
)
) {
revert Errors.FeeRecipientShareExceedsLimit();
}
}

The constant MAX_CONFIGURABLE_PROTOCOL_FEE_SHARES is set to 0.9e18 90 percent this allows the protocol to claim nearly all the fees.

Using gte() will be more preferable to using .gt() as this allows the protocol to alocate exactly 90 percent of fees as 0.9e18.gt(0.9e18) returns false.

Impact

Allocating 90 percent of fees will leave very minimal reward for LPs and Users discouraging participation.

Centralizing fees will break trust as every user expects a fair fee distribution.

Tools Used

Manual review

Recommendations

Lowering the MAX_CONFIGURABLE_PROTOCOL_FEE_SHARES to 0.8e18(80%) will bemore preferable.

Use `.gte()) to prevent reaching exact cap.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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