agent0.hyperfuzz.unit_fuzz

Shared functions for interactive fuzz testing.

Submodules

Functions

fuzz_long_short_maturity_values(num_trades, ...[, ...])

Does fuzzy invariant checks on closing longs and shorts past maturity.

fuzz_path_independence(num_trades, num_paths_checked, ...)

Does fuzzy invariant checks for opening and closing longs and shorts.

fuzz_present_value(test_epsilon, chain_config[, ...])

Does fuzzy invariant checks for opening and closing longs and shorts.

fuzz_profit_check(chain_config[, steth, pause_on_fail])

Fuzzes invariant checks for profit from long and short positions.

Package Contents

agent0.hyperfuzz.unit_fuzz.fuzz_long_short_maturity_values(num_trades: int, long_maturity_vals_epsilon: float, short_maturity_vals_epsilon: float, chain_config: agent0.core.hyperdrive.interactive.LocalChain.Config, steth: bool = False, pause_on_fail: bool = False)

Does fuzzy invariant checks on closing longs and shorts past maturity.

Parameters:
  • num_trades (int) – Number of trades to perform during the fuzz tests.

  • long_maturity_vals_epsilon (float) – The allowed error for maturity values equality tests for longs.

  • short_maturity_vals_epsilon (float) – The allowed error for maturity values equality tests for shorts.

  • chain_config (LocalChain.Config, optional) – Configuration options for the local chain.

  • steth (bool) – Whether to use steth instead of erc4626

  • pause_on_fail (bool) – If True, pause on test failure.

agent0.hyperfuzz.unit_fuzz.fuzz_path_independence(num_trades: int, num_paths_checked: int, lp_share_price_epsilon: float, effective_share_reserves_epsilon: float, present_value_epsilon: float, chain_config: agent0.core.hyperdrive.interactive.LocalChain.Config, steth: bool = False, pause_on_fail: bool = False)

Does fuzzy invariant checks for opening and closing longs and shorts.

Parameters:
  • num_trades (int) – Number of trades to perform during the fuzz tests.

  • num_paths_checked (int) – Number of paths (order of operations for opening/closing) to perform.

  • lp_share_price_epsilon (float) – The allowed error for LP share price equality tests.

  • effective_share_reserves_epsilon (float) – The allowed error for effective share reserves equality tests.

  • present_value_epsilon (float) – The allowed error for present value equality tests.

  • chain_config (LocalChain.Config, optional) – Configuration options for the local chain.

  • steth (bool) – Whether to use steth instead of erc4626

  • pause_on_fail (bool) – Whether to pause on failure.

agent0.hyperfuzz.unit_fuzz.fuzz_present_value(test_epsilon: float, chain_config: agent0.core.hyperdrive.interactive.LocalChain.Config, steth: bool = False, pause_on_fail: bool = False)

Does fuzzy invariant checks for opening and closing longs and shorts.

Parameters:
  • test_epsilon (float) – The allowed error for present value equality tests.

  • chain_config (LocalChain.Config, optional) – Configuration options for the local chain.

  • steth (bool) – Whether to use steth instead of erc4626

  • pause_on_fail (bool) – Whether to pause on failure.

agent0.hyperfuzz.unit_fuzz.fuzz_profit_check(chain_config: agent0.core.hyperdrive.interactive.LocalChain.Config, steth: bool = False, pause_on_fail: bool = False)

Fuzzes invariant checks for profit from long and short positions.

Parameters:
  • chain_config (LocalChain.Config, optional) – Configuration options for the local chain.

  • steth (bool) – Whether to use steth instead of erc4626

  • pause_on_fail (bool) – If True, pause on test failure.