-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Low Risk (L4): logic in getter estimateSpendUntilTimestamp
is miscalculated
#31
Comments
The test seems wrong.. You are right. I don't understand the second part. We want to know how much money will leave the injector before a given timestamp. Why would we look at how much money is scheduled to leave the injector by 1 week after that? |
Regarding the
We're referring to the scenario of the test, where the constant timestampOneWeekFromNow seems to signal that a week from now how much has being emitted, not a week after the 1st. The example it was more to illustrate the error in the test. |
You're right. This is wrong. See #46. It's an unnecessary function that adds confusion. |
concerning method was removed in #46 and its associates tests. this issue is now irrelevant, safe to close |
Severity: if it is used externally can lead to false conclusions in the figure and core level does not have critical impact.
Context: while reviewing the test
"should calculate spend for timestamp correctly"
the numerical expectations looks incorrect, since the the token used for testing has 6 decimalsRecommendation: first it is worth investigating why that value is expected in the test
500000000000400000000n
, while the distribution it is simply200000000/week
for 2 weeks as per the suite setter.Also, in
estimateSpendUntilTimestamp
seems to signal that would like to estimate the spend up to a specific timestamp, in the suite the value after a week would like to be checked for a single gauge, the expectation there would be200000000
for the single week, and if we would check for 2 weeks (timestampOneWeekFromNow * 2
) the expectation would be400000000
, but the values in the test does not seem to expect the same figures, which highlights that a miscalculation is happening in the loop.And, it is not considering the factor that the gauge
programStartTimestamp
in the getter at all, which can lead again to miscalculations reported by that method. That is something still to be included in the code snipper aboveIn another note, seems the method is basically a getter it is worth reconsidering its name convention to
getEstimateSpendUntilTimestamp
and follow the pattern.Review stage
Balancer Maxis:
Onchainification Labs:
The text was updated successfully, but these errors were encountered: