You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The applicableGas is 0, and the KeepConfig has multiplier Base set to 0. This means the fee calculation would be (0 + bufferBase) * gasPrice, which ignores the actual gas used.
Therefore, the _executeOrder function has the issue, where keeper fees aren't accurately calculated based on real gas consumption. This would lead to keepers being underpaid and potentially refusing to execute orders, harming protocol functionality.
The _executeOrder function in the MultiInvoker contract miscalculates keeper fees by hardcoding applicableGas = 0, bypassing actual gas usage tracking. This leads to fees that do not reflect real transaction costs.
Internal Pre-conditions
No response
External Pre-conditions
No response
Attack Path
Scenario:
User Action: Alice places a trigger order with a fee = 10 DSU.
Keeper Exec: Bob calls _executeOrder, spending 80,000 gas.
Fee Calculation:
applicableGas is 0 (hardcoded).
fee = (0 + keepBufferBase) * gasPrice = (0 + 10,000) * 20 gwei = 0.0002 ETH (converted to DSU).
Actual cost: 80,000 gas * 20 gwei = 0.0016 ETH.
Outcome:
Keeper receives 0.0002 ETH but spent 0.0016 ETH.
Loss: 0.0014 ETH per transaction. Keepers stop executing orders over time.
Clean Hemp Barracuda
Medium
Inaccurate Keeper Fee in Order Execution
Summary
The applicableGas is 0, and the KeepConfig has multiplier Base set to 0. This means the fee calculation would be (0 + bufferBase) * gasPrice, which ignores the actual gas used.
Therefore, the _executeOrder function has the issue, where keeper fees aren't accurately calculated based on real gas consumption. This would lead to keepers being underpaid and potentially refusing to execute orders, harming protocol functionality.
https://github.com/sherlock-audit/2025-01-perennial-v2-4-update/blob/main/perennial-v2/packages/periphery/contracts/MultiInvoker/MultiInvoker.sol#L433
https://github.com/sherlock-audit/2025-01-perennial-v2-4-update/blob/main/perennial-v2/packages/periphery/contracts/MultiInvoker/MultiInvoker.sol#L438
Root Cause
The
_executeOrder
function in theMultiInvoker
contract miscalculates keeper fees by hardcodingapplicableGas = 0
, bypassing actual gas usage tracking. This leads to fees that do not reflect real transaction costs.Internal Pre-conditions
No response
External Pre-conditions
No response
Attack Path
Scenario:
fee = 10 DSU
._executeOrder
, spending 80,000 gas.applicableGas
is 0 (hardcoded).fee = (0 + keepBufferBase) * gasPrice = (0 + 10,000) * 20 gwei = 0.0002 ETH
(converted to DSU).Code Reference:
Impact
keepBufferBase
) instead of real gas usage, causing financial losses for keepers.PoC
No response
Mitigation
gasleft()
before and after order execution.Fixed Code:
The text was updated successfully, but these errors were encountered: