This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
KingNFT - A significant 105,983
gas cost of processExecutionFee()
execution is not accounted in the keeper's compensation
#147
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
KingNFT
Medium
A significant
105,983
gas cost ofprocessExecutionFee()
execution is not accounted in the keeper's compensationSummary
At the end of
executeOrder()
,processExecutionFee()
is called to process gas compensation for the keeper. The issue here is that the gas usage ofprocessExecutionFee()
itself is not taken into consideration. As the following test case shows, it's significant (105,983
), can't be ignored.Vulnerability Detail
At the beginning of
executeOrder()
,startGas
is recorded (L67). At the end ofexecuteOrder()
,processExecutionFee()
is called to process gas compensation for the keeper (L76~86). The issue arises in theprocessExecutionFee()
function, the gas usage fromL19
toL41
is not taken into account.To test the specific unaccounted gas usage of
processExecutionFee()
, we made a minor modifications as follows:Then, by the following test script, we get the missing portion is
105,983
gas. It's significant and should not be ignored.And the test log:
Impact
The keeper will suffer continuing
100K
gas losses on each transaction due to the issue.Code Snippet
https://github.com/sherlock-audit/2024-05-elfi-protocol/blob/8a1a01804a7de7f73a04d794bf6b8104528681ad/elfi-perp-contracts/contracts/process/GasProcess.sol#L17
Tool used
Manual Review
Recommendation
Adding this portion as a fixed compensation for the keeper.
The text was updated successfully, but these errors were encountered: