Skip to content

Commit

Permalink
test: improve assumes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAustrian committed May 14, 2024
1 parent 8d6e1e7 commit 42aeb4a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/unit/BPool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ contract BPool_Unit_SwapExactAmountIn is BasePoolTest, BMath {
vm.assume(_fuzz.tokenOutBalance >= MIN_BALANCE);

// max - calcSpotPrice
vm.assume(_fuzz.tokenInBalance < type(uint256).max / BONE);
vm.assume(_fuzz.tokenOutBalance < type(uint256).max / BONE);
vm.assume(_fuzz.tokenInBalance < type(uint256).max / _fuzz.tokenInDenorm);
vm.assume(_fuzz.tokenOutBalance < type(uint256).max / _fuzz.tokenOutDenorm);

// internal calculation for calcSpotPrice
uint _numer = bdiv(_fuzz.tokenInBalance, _fuzz.tokenInDenorm);
Expand All @@ -576,6 +576,11 @@ contract BPool_Unit_SwapExactAmountIn is BasePoolTest, BMath {
// MAX_IN_RATIO
// vm.assume(_fuzz.tokenInBalance < type(uint256).max / MAX_IN_RATIO);
vm.assume(_fuzz.tokenAmountIn <= bmul(_fuzz.tokenInBalance, MAX_IN_RATIO));

// uint _spotPriceBefore = calcSpotPrice(_fuzz.tokenInBalance, _fuzz.tokenInDenorm, _fuzz.tokenOutBalance, _fuzz.tokenOutDenorm, MIN_FEE);
// uint _tokenAmountOut = calcOutGivenIn(_fuzz.tokenInBalance, _fuzz.tokenInDenorm, _fuzz.tokenOutBalance, _fuzz.tokenOutDenorm, _fuzz.tokenAmountIn, MIN_FEE);
// vm.assume(_tokenAmountOut > 0);
// vm.assume(_spotPriceBefore <= bdiv(_fuzz.tokenAmountIn, _tokenAmountOut));
}

modifier happyPath(SwapExactAmountIn_FuzzScenario memory _fuzz) {
Expand Down

0 comments on commit 42aeb4a

Please sign in to comment.