Root Cause: Multiple storage reads for the same owner()
value -> Impact: Unnecessary SLOADs increase transaction gas cost on every withdrawal.
The withdrawPlatformFees()
function invokes the owner()
view function twice—once to determine the payout recipient and again when emitting the event. Each call to owner()
performs an SLOAD to read the owner’s address from storage.
These redundant reads add extra gas overhead (~800 gas per read) every time the function executes. Although individually small, in high-frequency withdrawal scenarios or gas-sensitive environments, these inefficiencies accumulate and increase users’ costs.
Likelihood: High
First owner()
call: inside the .call{value: amount}
to determine the recipient.
Second owner()
call: in the emit
statement to log the event.
Issue: Both calls retrieve the same storage slot; one local variable could capture owner()
once and reuse it, saving a storage read.
Impact: Gas
Increased Transaction Cost: Each withdrawal pays +800 gas for the extra SLOAD.
Cumulative Waste: Over many withdrawals, the protocol (or users) spend unnecessary ETH.
Performance Degradation: In gas-sensitive contracts, eliminating even small inefficiencies matters.
Tools Used:
Foundry Test Suite
Chat-GPT AI Assistance (Report Grammar Check & Improvements)
Manual Review
Scenario:
Every time withdrawPlatformFees()
is called, it performs two independent storage reads for owner()
. By caching the owner’s address in a local variable, you eliminate one SLOAD, saving roughly 800 gas per call.
Cache owner()
Once
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.