sherlock-audit / 2024-06-magicsea-judging

2 stars 0 forks source link

Lone Opaque Mustang - Position creation has missing `_maxGlobalMultiplier` limiter check on `totalMultiplier` #694

Closed sherlock-admin4 closed 2 months ago

sherlock-admin4 commented 2 months ago

Lone Opaque Mustang

Low/Info

Position creation has missing _maxGlobalMultiplier limiter check on totalMultiplier

Summary

A new position's totalMultiplier is directly set to lockMultiplier, but it lacks the _maxGlobalMultiplier check that is enforced in _updateBoostMultiplierInfoAndRewardDebt().

Vulnerability Detail

_updateBoostMultiplierInfoAndRewardDebt() has a check to ensure that a modified position's totalMultiplier does not exceed _maxGlobalMultiplier. However, when creating a position, this check is not done.

Hence, should the configured _maxLockMultiplier exceed _maxGlobalMultiplier, the newly created position would have a larger than allowed total multiplier.

Impact

Initial totalMultiplier may exceed _maxGlobalMultiplier.

Code Snippet

https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/MlumStaking.sol#L382 https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/MlumStaking.sol#L659

Tool used

Manual Review

Recommendation

Add the _maxGlobalMultiplier in createPosition().