The allocateFunds() function in the Treasury.sol contract does not correctly accumulate fund allocations. Instead of adding the new allocation amount to the existing value, it resets the allocation for the recipient to the new amount. This behavior leads to unintended overwriting of previous allocations, which may cause incorrect fund tracking and misallocation of treasury funds.
Treasury.solWhen an allocator assigns funds to a recipient, the allocated amount should be added to any existing allocation.
The function directly assigns amount to _allocations[msg.sender][recipient], completely replacing any previous allocation instead of incrementing it.
Loss of Previous Allocations: Each time allocateFunds() is called for a recipient, the previous allocation amount is erased, leading to incorrect allocation tracking.
Misallocation of Treasury Funds: Allocators may unknowingly override previously allocated funds, leading to improper fund distribution.
Inconsistent Fund Tracking: Allocations do not accumulate as expected, leading to inaccurate records.
Potential Loss of Allocated Funds: If an allocator intends to distribute funds progressively, prior allocations are lost with each new transaction.
Manual Code Review
Modify allocateFunds() to Accumulate Allocations Instead of Overwriting:
Add Event Logging for Previous and New Allocation Amounts:
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.