agent0.hyperfuzz.unit_fuzz.fuzz_profit_check ============================================ .. py:module:: agent0.hyperfuzz.unit_fuzz.fuzz_profit_check .. autoapi-nested-parse:: Script for fuzzing profit values on immediately opening & closing a long or short. # Test procedure - spin up local chain, deploy hyperdrive with fees - open a long for a random amount - advance time, but not enough to trigger a new checkpoint - close the long - open a short for a random amount - advance time, but not enough to trigger a new checkpoint - close the short - invariance checks # Invariance checks (these should be True): # We are checking that the agent made made no profit - Repeat these two checks for the longs & shorts - transaction receipt: base amount returned < base amount provided - agent wallet: final balance <= initial balance - Specific values checked - trade amount - agent initial balance - agent final balance .. !! processed by numpydoc !! Classes ------- .. autoapisummary:: agent0.hyperfuzz.unit_fuzz.fuzz_profit_check.Args Functions --------- .. autoapisummary:: agent0.hyperfuzz.unit_fuzz.fuzz_profit_check.main agent0.hyperfuzz.unit_fuzz.fuzz_profit_check.fuzz_profit_check agent0.hyperfuzz.unit_fuzz.fuzz_profit_check.namespace_to_args agent0.hyperfuzz.unit_fuzz.fuzz_profit_check.parse_arguments agent0.hyperfuzz.unit_fuzz.fuzz_profit_check.invariant_check Module Contents --------------- .. py:function:: main(argv: Sequence[str] | None = None) Primary entrypoint. :param argv: The argv values returned from argparser. :type argv: Sequence[str] .. !! processed by numpydoc !! .. py:function:: 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. :param chain_config: Configuration options for the local chain. :type chain_config: LocalChain.Config, optional :param steth: Whether to use steth instead of erc4626 :type steth: bool :param pause_on_fail: If True, pause on test failure. :type pause_on_fail: bool .. !! processed by numpydoc !! .. py:class:: Args Bases: :py:obj:`NamedTuple` Command line arguments for the invariant checker. .. !! processed by numpydoc !! .. py:attribute:: chain_config :type: agent0.core.hyperdrive.interactive.LocalChain.Config .. py:function:: namespace_to_args(namespace: argparse.Namespace) -> Args Converts argprase.Namespace to Args. :param namespace: Object for storing arg attributes. :type namespace: argparse.Namespace :returns: Formatted arguments :rtype: Args .. !! processed by numpydoc !! .. py:function:: parse_arguments(argv: Sequence[str] | None = None) -> Args Parses input arguments. :param argv: The argv values returned from argparser. :type argv: Sequence[str] :returns: Formatted arguments :rtype: Args .. !! processed by numpydoc !! .. py:function:: invariant_check(check_data: dict[str, Any]) -> None Check the pool state invariants. :param check_data: The trade data to check. :type check_data: dict[str, Any] .. !! processed by numpydoc !!