Skip to content

Commit

Permalink
test: improve weights in assumes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAustrian committed May 16, 2024
1 parent 3bbdefc commit 73ac5c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/unit/BPool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ contract BPool_Unit_SwapExactAmountIn is BasePoolTest {

function _assumeHappyPath(SwapExactAmountIn_FuzzScenario memory _fuzz) internal pure {
// safe bound assumptions
_fuzz.tokenInDenorm = bound(_fuzz.tokenInDenorm, MIN_WEIGHT, MAX_WEIGHT);
_fuzz.tokenOutDenorm = bound(_fuzz.tokenOutDenorm, MIN_WEIGHT, MAX_WEIGHT);
_fuzz.tokenInDenorm = bound(_fuzz.tokenInDenorm, MIN_WEIGHT, MAX_WEIGHT / 2);
_fuzz.tokenOutDenorm = bound(_fuzz.tokenOutDenorm, MIN_WEIGHT, MAX_WEIGHT / 2);
_fuzz.swapFee = bound(_fuzz.swapFee, MIN_FEE, MAX_FEE);

// min
Expand Down Expand Up @@ -748,8 +748,8 @@ contract BPool_Unit_SwapExactAmountOut is BasePoolTest {

function _assumeHappyPath(SwapExactAmountOut_FuzzScenario memory _fuzz) internal pure {
// safe bound assumptions
_fuzz.tokenInDenorm = bound(_fuzz.tokenInDenorm, MIN_WEIGHT, MAX_WEIGHT);
_fuzz.tokenOutDenorm = bound(_fuzz.tokenOutDenorm, MIN_WEIGHT, MAX_WEIGHT);
_fuzz.tokenInDenorm = bound(_fuzz.tokenInDenorm, MIN_WEIGHT, MAX_WEIGHT / 2);
_fuzz.tokenOutDenorm = bound(_fuzz.tokenOutDenorm, MIN_WEIGHT, MAX_WEIGHT / 2);
_fuzz.swapFee = bound(_fuzz.swapFee, MIN_FEE, MAX_FEE);

// min
Expand Down Expand Up @@ -898,9 +898,9 @@ contract BPool_Unit_JoinswapExternAmountIn is BasePoolTest {

function _assumeHappyPath(JoinswapExternAmountIn_FuzzScenario memory _fuzz) internal pure {
// safe bound assumptions
_fuzz.tokenInDenorm = bound(_fuzz.tokenInDenorm, MIN_WEIGHT, MAX_WEIGHT);
_fuzz.tokenInDenorm = bound(_fuzz.tokenInDenorm, MIN_WEIGHT, MAX_WEIGHT / 2);
_fuzz.swapFee = bound(_fuzz.swapFee, MIN_FEE, MAX_FEE);
_fuzz.totalWeight = bound(_fuzz.totalWeight, MIN_WEIGHT * MAX_BOUND_TOKENS, MAX_WEIGHT * MAX_BOUND_TOKENS);
_fuzz.totalWeight = bound(_fuzz.totalWeight, MIN_WEIGHT * MAX_BOUND_TOKENS, MAX_TOTAL_WEIGHT);

vm.assume(_fuzz.totalSupply >= INIT_POOL_SUPPLY);

Expand Down

0 comments on commit 73ac5c7

Please sign in to comment.