-
Notifications
You must be signed in to change notification settings - Fork 3
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
test(invariant): include delay in each period #254
Conversation
41b4975
to
3e2c5fd
Compare
@andreivladbrg should we merge it into #240 so that we can test #240 with your changes? |
you need to make additional changes (remove |
OK but shouldn't we create this PR against that branch instead of
I am now more confident that fix is better than |
While reviewing this PR, a few thoughts came to mind:
|
Thanks for the feedback.
Actually we are comparing "states" (
we did not modified to "pass" the test, but we modified to test the fact the delay is a real thing in certain functions (e.g.
if the solution in the
what core logic is used in this test? it compares the states (totalDebt, and implicitly the
not sure what you mean, it was always this way
that's exactly the problem IMO. we are asserting something that we don't why exactly is is below. the delay happens in the flow contract without actually writing logic per se for it the contract. we are testing (exactly) a behaviour that happens as a "consequence" of fixed point numbers and how rational math works to make an analogy, why i say using a percentage like 0.1% is not that precise, is like testing in withdraw, that the balance of the stream has simply decreased, instead of testing exactly the new balance is:
i disagree with this; therefore, i highly suggest keeping this implementation as it is more robust. besides the state test, it also tests a behavior that occurs unintentionally |
c07decb
to
1c3905c
Compare
@smol-ninja added the new assert in the invariant that ensures no over streaming: assertGe(
totalStreamedAmount,
totalStreamedAmountWithDelay,
"Invariant violation: total streamed amount >= total streamed amount with delay"
); |
ci: undo ci runs
test: implement two different function for calculating total streamed amount
1c3905c
to
92cdc8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for making all those changes. What I was suggesting is something similar to #258 where instead of having a dynamic delay variable, we set fixed limits to ensure the differences never exceed those bounds. And if in the future, we see a test which fails because the difference exceed the bounds that would mean, we have to give it attention. With dynamic delay, that wont be possible because even if the delay is 1 week, lets say, the test would still pass.
However, given we merge that fuzz test, I am fine with your implementation. I only want to have some test that keep checking that delay is within limits.
New commits that requires your attentions:
thanks, looks good, merging |
This PR is fixing the
invariant_TotalStreamedEqTotalDebtPlusWithdrawn
invariant by introducing thedelay
in the Period struct.Refer to: https://gist.github.com/andreivladbrg/b5968b8c16f5924d082dbce607f55e97#first-example