Skip to content

Commit

Permalink
test: limiting unbalanced liquidity deposits
Browse files Browse the repository at this point in the history
the "jump" in liquidity has to be stricter since otherwise it would nuke the pool
  • Loading branch information
AlbertoCentonze committed May 22, 2024
1 parent b580be8 commit 66fa937
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/unitary/pool/stateful/test_stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,14 @@ def add_liquidity_imbalanced(
for i in range(2)
]

# 1e7 is a magic number that was found by trial and error (limits
# increase to 1000x times the liquidity of the pool)
JUMP_LIMIT = 1e7
# this is a magic number that was found by trial and error
JUMP_LIMIT = 1e4
# we make sure that the amount being deposited is not much
# bigger than the amount already in the pool, otherwise the
# pool math will break.
assume(
liquidity_jump_ratio[0] < JUMP_LIMIT
and liquidity_jump_ratio[1] < JUMP_LIMIT
)
for jump in liquidity_jump_ratio:
assume(jump < JUMP_LIMIT)

note(
"imabalanced deposit of liquidity: {:.1%}/{:.1%} => ".format(
imbalance_ratio, 1 - imbalance_ratio
Expand Down

0 comments on commit 66fa937

Please sign in to comment.