Skip to content

Commit

Permalink
test: check for onchain error instead of dev reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoCentonze committed Feb 4, 2025
1 parent 030a6b7 commit a7ab1a5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/fuzzing/test_get_y.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def test_get_y_revert(math_contract):
D = 224824250915890636214130540882688
i = 0

with boa.reverts(dev="unsafe values A"):
with boa.reverts("unsafe values A"):
math_contract.newton_y(a, gamma, x, D, i)

with boa.reverts(dev="unsafe values A"):
with boa.reverts("unsafe values A"):
math_contract.get_y(a, gamma, x, D, i)


Expand Down
2 changes: 1 addition & 1 deletion tests/unitary/pool/admin/test_revert_commit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ def test_commit_rebalancing_params(swap, factory_admin, params):


def test_revert_unauthorised_commit(swap, user, params):
with boa.env.prank(user), boa.reverts(dev="only owner"):
with boa.env.prank(user), boa.reverts("only owner"):
_apply_new_params(swap, params)
16 changes: 8 additions & 8 deletions tests/unitary/pool/admin/test_revert_ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def test_revert_unauthorised_ramp(swap, user):
with boa.env.prank(user), boa.reverts(dev="only owner"):
with boa.env.prank(user), boa.reverts("only owner"):
swap.ramp_A_gamma(1, 1, 1)


Expand All @@ -17,14 +17,14 @@ def test_revert_ramp_while_ramping(swap, factory_admin):
with boa.env.prank(factory_admin):
swap.ramp_A_gamma(A_gamma[0] + 1, A_gamma[1] + 1, future_time)

with boa.reverts(dev="ramp undergoing"):
with boa.reverts("ramp undergoing"):
swap.ramp_A_gamma(A_gamma[0], A_gamma[1], future_time)


def test_revert_fast_ramps(swap, factory_admin):
A_gamma = [swap.A(), swap.gamma()]
future_time = boa.env.evm.patch.timestamp + 10
with boa.env.prank(factory_admin), boa.reverts(dev="insufficient time"):
with boa.env.prank(factory_admin), boa.reverts("ramp time<min"):
swap.ramp_A_gamma(A_gamma[0] + 1, A_gamma[1] + 1, future_time)


Expand All @@ -37,7 +37,7 @@ def test_revert_unauthorised_stop_ramp(swap, factory_admin, user):
with boa.env.prank(factory_admin):
swap.ramp_A_gamma(A_gamma[0] + 1, A_gamma[1] + 1, future_time)

with boa.env.prank(user), boa.reverts(dev="only owner"):
with boa.env.prank(user), boa.reverts("only owner"):
swap.stop_ramp_A_gamma()


Expand All @@ -49,16 +49,16 @@ def test_revert_ramp_too_far(swap, factory_admin):
gamma = swap.gamma()
future_time = boa.env.evm.patch.timestamp + UNIX_DAY + 1

with boa.env.prank(factory_admin), boa.reverts(dev="A change too high"):
with boa.env.prank(factory_admin), boa.reverts("A change too high"):
future_A = A * 11 # can at most increase by 10x
swap.ramp_A_gamma(future_A, gamma, future_time)
with boa.env.prank(factory_admin), boa.reverts(dev="A change too low"):
with boa.env.prank(factory_admin), boa.reverts("A change too low"):
future_A = A // 11 # can at most decrease by 10x
swap.ramp_A_gamma(future_A, gamma, future_time)

with boa.env.prank(factory_admin), boa.reverts(dev="gamma change too high"):
with boa.env.prank(factory_admin), boa.reverts("gamma change too high"):
future_gamma = gamma * 11 # can at most increase by 10x
swap.ramp_A_gamma(A, future_gamma, future_time)
with boa.env.prank(factory_admin), boa.reverts(dev="gamma change too low"):
with boa.env.prank(factory_admin), boa.reverts("gamma change too low"):
future_gamma = gamma // 11 # can at most decrease by 10x
swap.ramp_A_gamma(A, future_gamma, future_time)
2 changes: 1 addition & 1 deletion tests/unitary/pool/test_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@ def test_exchange_received_revert_on_no_transfer(

calculated = views_contract.get_dy(i, j, amount, swap_with_deposit)

with boa.env.prank(user), boa.reverts(dev="user didn't give us coins"):
with boa.env.prank(user), boa.reverts("user didn't give us coins"):
swap_with_deposit.exchange_received(i, j, amount, int(0.999 * calculated), user)

0 comments on commit a7ab1a5

Please sign in to comment.