Flow

Sablier
FoundryDeFi
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Potential Inconsistency in aggregateBalance Updates

Description

location : src/SablierFlow.sol

The contract maintains an aggregateBalance mapping of token addresses to uint256 values, representing the total balance of each token held by the contract.

However, in some places, the aggregateBalance is updated without corresponding checks, and relies on assumptions that may not always hold.

For example, in the _withdraw function:

unchecked {
// Effect: update the aggregate balance.
aggregateBalance[token] -= amount;
}

If the amount to subtract exceeds the aggregateBalance[token], this could cause an underflow error.

Impact

Potential underflows in aggregateBalance can lead to incorrect tracking of token balances, which can have downstream effects on contract logic that relies on this value.

Recommendation

  • Ensure Accurate Updates to aggregateBalance: Before updating aggregateBalance, verify that the amount to be subtracted does not exceed the current aggregateBalance.

Add a check:

require(aggregateBalance[token] >= amount, "Insufficient aggregate balance");
aggregateBalance[token] -= amount;

Verify that all updates to aggregateBalance correctly reflect the actual token transfers.

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Too generic
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.