The StabilityPool contract supports two distinct administrative features:
Manager Allocations:
The contract allows the owner to add managers and assign them an allocation via functions such as addManager, removeManager, and updateAllocation.
Market Allocations:
Separately, the contract supports adding markets with specified allocations through addMarket, removeMarket, and updateMarketAllocation.
-->both sets of functions modify and rely on a single uint256 public totalAllocation variable. This conflation of allocations for managers and markets into one global variable introduces the risk of mis‑calculation or unintended interference between the two allocation systems.
Conflated State:
The same totalAllocation is updated in both manager‑related and market‑related functions. For example:
When a manager is added, totalAllocation += allocation; is executed.
Later, when a market is added, totalAllocation += allocation; is also executed.
Similarly, removals or updates for either managers or markets adjust the same totalAllocation.
Mis‑allocation Risk:
If these two allocation mechanisms are meant to be independent, using a single variable may lead to a situation where:
The overall total allocation does not accurately reflect the intended distribution for either managers or markets.
An attacker or malicious administrator could manipulate one part (for instance, by adding or updating market allocations) to skew the global total and thereby influence reward distribution mechanisms that depend on totalAllocation.
Operational Confusion:
External systems or interfaces that rely on getTotalAllocation() will receive a blended value, making it difficult to audit or verify proper reward distribution between managers and markets.
Note:
This test shows that the global totalAllocation becomes the sum of both managers’ and markets’ allocations. While the arithmetic is correct, it demonstrates that the two systems are merged, which may be unintentional if independent tracking was intended.
Recommended Fix:
Separate the tracking variables for manager allocations and market allocations. For example, declare:
Then update the respective functions so that:
Manager functions update totalManagerAllocation only.
Market functions update totalMarketAllocation only.
If a unified total is needed for a specific purpose, derive it from the sum of the two (e.g., totalUnifiedAllocation = totalManagerAllocation + totalMarketAllocation). This separation improves clarity and prevents one allocation system from unintentionally affecting the other.
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.