Skip to content

Commit

Permalink
test: use equality in invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Oct 24, 2024
1 parent e41a469 commit d5cb6de
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/invariant/Flow.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ contract Flow_Invariant_Test is Base_Test {
}

/// @dev For non-voided streams, the expected streamed amount should be greater than or equal to the sum of total
/// debt and withdrawn amount. And, the difference between the two should not exceed 10 mvt.
/// debt and withdrawn amount.
function invariant_TotalStreamedEqTotalDebtPlusWithdrawn() external view {
uint256 lastStreamId = flowStore.lastStreamId();
for (uint256 i = 0; i < lastStreamId; ++i) {
Expand All @@ -345,16 +345,10 @@ contract Flow_Invariant_Test is Base_Test {
calculateExpectedStreamedAmount(flowStore.streamIds(i), flow.getTokenDecimals(streamId));
uint256 actualTotalStreamed = flow.totalDebtOf(streamId) + flowStore.withdrawnAmounts(streamId);

assertGe(
assertEq(
expectedTotalStreamed,
actualTotalStreamed,
"Invariant violation: expected streamed amount >= total debt + withdrawn amount"
);

assertLe(
expectedTotalStreamed - actualTotalStreamed,
10,
"Invariant violation: expected streamed amount - total debt + withdrawn amount <= 10"
"Invariant violation: expected total streamed amount != total debt + withdrawn amount"
);
}
}
Expand Down

0 comments on commit d5cb6de

Please sign in to comment.