Under normal behavior, when a user deposits funds via stake(), the system records their entry timestamp to calculate time-weighted bonus shares. If the pool is already in an active-risk state (riskWindowStart != 0), late deposits are time-weighted from the moment of their entry.
In ConfidencePool.stake(), the code assigns newEntry = block.timestamp and then attempts to clamp it using if (start != 0 && newEntry < start) newEntry = start;. However, because riskWindowStart is strictly set to block.timestamp at the moment risk is first observed, and time only moves forward in the EVM, the current block.timestamp can never be less than riskWindowStart. This makes the conditional check entirely redundant dead code.
Likelihood: High
Every single call to stake() evaluates this redundant branch.
Impact: Low
Stakers waste a trivial amount of gas evaluating an impossible condition.
The riskWindowStart is only ever set to block.timestamp (in _markRiskWindowStart()), meaning any subsequent transaction's block.timestamp will always be ≥ riskWindowStart. The condition newEntry < start will strictly evaluate to false.
Remove the redundant clamping logic to save gas and improve readability.
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.
The contest is complete and the rewards are being distributed.