Skip to content

Commit

Permalink
update limits in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Oct 11, 2023
1 parent 7797ad4 commit 39963c8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
1 change: 1 addition & 0 deletions contracts/main/CurveCryptoMathOptimized2.vy
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def get_y(
) -> uint256[2]:

# Safety checks
print(_ANN, MIN_A, MAX_A)
assert _ANN > MIN_A - 1 and _ANN < MAX_A + 1 # dev: unsafe values A
assert _gamma > MIN_GAMMA - 1 and _gamma < MAX_GAMMA + 1 # dev: unsafe values gamma
assert _D > 10**17 - 1 and _D < 10**15 * 10**18 + 1 # dev: unsafe values D
Expand Down
6 changes: 3 additions & 3 deletions tests/unitary/math/test_get_y.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
N_COINS = 2
MAX_SAMPLES = 1000000 # Increase for fuzzing

A_MUL = 10000 * 2**2
MIN_A = int(0.01 * A_MUL)
MAX_A = 1000 * A_MUL
A_MUL = 10000
MIN_A = int(N_COINS**N_COINS * A_MUL / 10)
MAX_A = int(N_COINS**N_COINS * A_MUL * 100000)

# gamma from 1e-8 up to 0.05
MIN_GAMMA = 10**10
Expand Down
6 changes: 3 additions & 3 deletions tests/unitary/math/test_newton_D.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def inv_target_decimal_n2(A, gamma, x, D):
N_COINS = 2
MAX_SAMPLES = 3000000 # Increase for fuzzing

A_MUL = 10000 * 2**2
MIN_A = int(0.01 * A_MUL)
MAX_A = 1000 * A_MUL
A_MUL = 10000
MIN_A = int(N_COINS**N_COINS * A_MUL / 10)
MAX_A = int(N_COINS**N_COINS * A_MUL * 100000)

# gamma from 1e-8 up to 0.05
MIN_GAMMA = 10**10
Expand Down
36 changes: 36 additions & 0 deletions tests/unitary/pool/test_exchange_received.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import boa
from boa.test import strategy
from hypothesis import given, settings # noqa

from tests.fixtures.pool import INITIAL_PRICES
from tests.utils.tokens import mint_for_testing

SETTINGS = {"max_examples": 100, "deadline": None}


@given(
amount=strategy(
"uint256", min_value=10**10, max_value=10**6 * 10**18
),
split_in=strategy(
"uint256", min_value=0, max_value=100
),
split_out=strategy(
"uint256", min_value=0, max_value=100
),
i=strategy("uint", min_value=0, max_value=1),
j=strategy("uint", min_value=0, max_value=1),
)
@settings(**SETTINGS)
def test_exchange_split(
swap_with_deposit,
views_contract,
coins,
user,
amount,
split_in,
split_out,
i,
j
):
pass

0 comments on commit 39963c8

Please sign in to comment.