sherlock-audit / 2023-09-perennial-judging

0 stars 0 forks source link

JP_Courses - PAccumulator6::accumulate() - struct PAccumulator6's storage variables not updated in accumulate() function. #58

Closed sherlock-admin closed 11 months ago

sherlock-admin commented 11 months ago

JP_Courses

medium

PAccumulator6::accumulate() - struct PAccumulator6's storage variables not updated in accumulate() function.

Summary

https://github.com/sherlock-audit/2023-09-perennial/blob/main/root/contracts/pid/types/PAccumulator6.sol#L7-L11 https://github.com/sherlock-audit/2023-09-perennial/blob/main/root/contracts/pid/types/PAccumulator6.sol#L58-L59

Unless my interpretation is incorrect, it appears that the accumulate() is not correctly updating state/storage variables for struct PAccumulator6.

/// @dev PAccumulator6 type
struct PAccumulator6 {
    Fixed6 _value;
    Fixed6 _skew;
}

Here the function is updating memory instance of struct's _value & _skew values, and not the state/storage instance of struct's values:

        self._value = newValue;
        self._skew = skew;

Vulnerability Detail

Impact

Code Snippet

Tool used

Manual Review

Recommendation

sherlock-admin commented 11 months ago

3 comment(s) were left on this issue during the judging contest.

panprog commented:

invalid because it's a library function

n33k commented:

invalid, incomplete report

darkart commented:

Bad Report

dappconsulting commented 11 months ago

Thanks. I disagree with the incomplete & bad report comments. Maybe I didnt have much else to write about/report for this specific finding other than the fact that the state variables appear to not get updated when they should be. I showed both the state variables from the struct, and the actual function where it seems it fails to update any state variables.

However, what I do accept obviously is if this finding is out of scope. If that's the case but the finding itself is still valid?, then the sponsor/client should obviously be made aware of it.