Impact – High gas consumption for routine operations increases user costs and reduces network efficiency, particularly during frequent claims or owner operations, potentially discouraging faucet usage.
Normal behavior:
The faucet contract allows users to claim tokens and optionally Sepolia ETH, and the owner to mint, burn, or adjust limits. These operations should execute efficiently while maintaining security.
Issue:
The original contract used redundant storage writes, non-immutable constants, and unnecessary public variables. Public variables generate automatic getter functions, which consume extra gas when accessed in other contracts. This caused extra gas consumption during claims, owner operations, and any external read access.
Getter functions:
Previously, making many state variables public created automatic getters in bytecode, which increases contract size and gas if called externally. Changing them to private and providing explicit view functions reduces unnecessary bytecode and allows more controlled, efficient access.
Likelihood:
High — Every call to claimFaucetTokens() triggers multiple unnecessary storage reads/writes and redundant getter code execution.
Frequent — Owner operations like minting, burning, and adjusting daily limits also write to storage inefficiently.
Impact:
Increased gas cost for every transaction.
Users may pay higher fees for token claims.
Potential cumulative network inefficiency for high-volume usage.
Contract size reduced, lowering deployment gas.
We replaced frequently accessed public variables with private immutable or private variables to reduce gas costs from automatic getters and unnecessary storage writes. Unused variables were removed, and critical state updates were optimized using local variables and unchecked arithmetic. Explicit getter functions were added for controlled access, reducing bytecode size and improving overall gas efficiency without changing functionality.
Additional optimizations applied:
Local variables for claimer and contract token balance to avoid multiple storage reads.
Immutable variables for constants (i_faucetDrip, i_sepEthAmountToDrip, i_dailySepEthCap) to reduce SLOAD gas costs.
nonReentrant modifier added for security while keeping gas-efficient state updates.
Explicit getters replace automatic public getters, reducing bytecode size and gas.
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.