Skip to content
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

Not compound rate variation ? #7

Closed
MathisGD opened this issue Sep 1, 2023 · 1 comment
Closed

Not compound rate variation ? #7

MathisGD opened this issue Sep 1, 2023 · 1 comment

Comments

@MathisGD
Copy link
Contributor

MathisGD commented Sep 1, 2023

          I seriously wonder if it is not a bit overkill. This computation cost a non-negligible amount of gas, and it is complex: it requires to ensure that there are no overflow in a computation up to a power of 12 (and it has also a limit when the linear variation is < -3).

Something simpler like

        uint256 variationMultiplier = WAD_INT + linearVariation;

would not have those issues. I understand that we would lose the property that having multiple updates in an interval is the same as having one update at the end, but this is only a third order loss in the worst case:

  • approximating an amount is a first order precision issue
  • approximating the rate (for example linear instead of compounded) is a second order precision issue
  • approximating the variation of the rate is a third order precision issue

It was already unclear for rates if it was worth the extra computation cost, it may be the case here that it's not worth at all

Originally posted by @QGarchery in #1 (comment)

@MathisGD MathisGD assigned MathisGD and unassigned MathisGD Sep 2, 2023
@MathisGD
Copy link
Contributor Author

MathisGD commented Sep 4, 2023

I think that the benefit of this is small now that we have #12

@MathisGD MathisGD closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant