Skip to content

Commit

Permalink
fix: crytic#13 add_test_range & sub_test_range false negatives
Browse files Browse the repository at this point in the history
  • Loading branch information
beber89 committed Mar 15, 2023
1 parent b167773 commit c02e20d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contracts/Math/ABDKMath64x64/ABDKMath64x64PropertyTests.sol
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ contract CryticABDKMath64x64Properties {
int128 result;
try this.add(x, y) {
result = this.add(x, y);
assert(result <= MAX_64x64 && result >= MIN_64x64);
assert(!(x >= 0 && y >= 0) || (result >= x && result >= y));
assert(!(x < 0 && y < 0) || (result < y && result < x));
} catch {
// If it reverts, just ignore
}
Expand Down Expand Up @@ -431,7 +432,8 @@ contract CryticABDKMath64x64Properties {
int128 result;
try this.sub(x, y) {
result = this.sub(x, y);
assert(result <= MAX_64x64 && result >= MIN_64x64);
assert(!(x >= 0 && y <= 0) || (result >= x && result >= neg (y)));
assert(!(x < 0 && y >= 0) || (result < neg(y) && result <= x));
} catch {
// If it reverts, just ignore
}
Expand Down

0 comments on commit c02e20d

Please sign in to comment.