Skip to content

Commit

Permalink
dry up
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Nov 11, 2024
1 parent 8adfe9f commit d2f3915
Showing 1 changed file with 16 additions and 29 deletions.
45 changes: 16 additions & 29 deletions src/agent0/hyperfuzz/system_fuzz/invariant_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,39 +301,26 @@ def _check_negative_interest(interface: HyperdriveReadInterface, pool_state: Poo
exception_data["invariance_check:current_vault_share_price"] = current_vault_share_price
exception_data["invariance_check:previous_vault_share_price"] = previous_vault_share_price
failed = True
# Different error messages and log levels if the pool is paused
if interface.get_pool_is_paused():
exception_message = (
"Negative interest detected between block "
f"{previous_pool_state.block_number} "
"at time "
f"{previous_pool_state.block_time} "
"and block "
f"{pool_state.block_number} "
"at time "
f"{pool_state.block_time} "
"on paused pool. "
f"{current_vault_share_price=}, {previous_vault_share_price=}. "
"Difference in wei: "
f"{current_vault_share_price.scaled_value - previous_vault_share_price.scaled_value}."
)
paused_str = "paused"
log_level = logging.WARNING
else:
exception_message = (
"Negative interest detected beteween block "
f"{previous_pool_state.block_number} "
"at time "
f"{previous_pool_state.block_time} "
"and block "
f"{pool_state.block_number} "
"at time "
f"{pool_state.block_time} "
"on unpaused pool. "
f"{current_vault_share_price=}, {previous_vault_share_price=}. "
"Difference in wei: "
f"{current_vault_share_price.scaled_value - previous_vault_share_price.scaled_value}."
)
paused_str = "unpaused"
log_level = logging.CRITICAL
exception_message = (
"Negative interest detected beteween block "
f"{previous_pool_state.block_number} "
"at time "
f"{previous_pool_state.block_time} "
"and block "
f"{pool_state.block_number} "
"at time "
f"{pool_state.block_time} "
f"on {paused_str} pool. "
f"{current_vault_share_price=}, {previous_vault_share_price=}. "
"Difference in wei: "
f"{current_vault_share_price.scaled_value - previous_vault_share_price.scaled_value}."
)

return InvariantCheckResults(failed, exception_message, exception_data, log_level=log_level)

Expand Down

0 comments on commit d2f3915

Please sign in to comment.