Skip to content

Commit

Permalink
Adding an epsilon of 1 wei to present value idle shares invariance check
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui committed Oct 30, 2024
1 parent 246f108 commit 2a62fba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/agent0/hyperfuzz/system_fuzz/invariant_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
LP_SHARE_PRICE_EPSILON = 1e-4
TOTAL_SHARES_EPSILON = 1e-9
NEGATIVE_INTEREST_EPSILON = FixedPoint(scaled_value=10) # 10 wei
PRESENT_VALUE_EPSILON = FixedPoint(scaled_value=1) # 1 wei


def run_invariant_checks(
Expand Down Expand Up @@ -477,7 +478,7 @@ def _check_present_value_greater_than_idle_shares(
failed=True, exception_message=repr(e), exception_data=exception_data, log_level=logging.CRITICAL
)

if not present_value >= idle_shares:
if not present_value >= (idle_shares - PRESENT_VALUE_EPSILON):
difference_in_wei = abs(present_value.scaled_value - idle_shares.scaled_value)
exception_message = f"{present_value=} < {idle_shares=}, {difference_in_wei=}"
exception_data["invariance_check:idle_shares"] = idle_shares
Expand Down

0 comments on commit 2a62fba

Please sign in to comment.