The function _distributeToGauges
iterates over the entire _gaugeList
twice, which can lead to high gas consumption if the list size becomes large. This is a risk if an external actor can influence the array length, as they can add many elements, causing the function to exceed the gas limit and fail. This could result in a Denial of Service (DoS) attack, where the distribution of rewards becomes impossible.
Gas Consumption Risk: The function performs two loops over _gaugeList
, which can result in high gas costs if the list is large.
External Manipulation: An attacker can increase the list size by adding gauges, potentially leading to excessive gas usage and failed transactions.
Denial of Service (DoS): Excessive gas usage can prevent reward distribution from being processed correctly.
Exploitable by Adversaries: An attacker can manipulate the array length to cause the transaction to exceed the block gas limit, disrupting contract operations.
An attacker could add a large number of gauges to the list, increasing gas usage during the loop:
Maintain a running total of gauge weights and only iterate over the relevant gauges. You can store a totalTypeWeight
and gaugeWeights
separately for active gauges to avoid looping through the entire array.
By ensuring the weight is tracked and updated more efficiently, you eliminate the risk of excessive gas usage.
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.