This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
mstpr-brainbot - Keepers loss gas is never accounted #108
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
mstpr-brainbot
High
Keepers loss gas is never accounted
Summary
When keepers send excess gas, the excess gas is accounted in Diamonds storage so that keeper can compensate itself later. However, losses are never accounted due to math error in calculating it.
Vulnerability Detail
Almost every facet uses the same pattern, which eventually calls the
GasProcess::processExecutionFee
function:As we can see in the snippet above, if the execution fee is higher than the user's provided execution fee, then the execution fee is set to
cache.userExecutionFee
, and the loss fee is calculated as the difference between these two, which are now the same value. This means thelossFee
variable will always be "0", and the loss fees for keepers will never be accounted for.Impact
In a scaled system, these fees will accumulate significantly, resulting in substantial losses for the keeper. Hence, labelling it as high.
Code Snippet
https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/process/GasProcess.sol#L17-L40
Tool used
Manual Review
Recommendation
The text was updated successfully, but these errors were encountered: