Skip to content

Commit

Permalink
update to doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenneke committed May 24, 2024
1 parent 1d5acf8 commit be7efc8
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/monitoring_tests/cowamm_commitment_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Checks that surplus of CoW AMM jit orders equals nonlinear surplus.
Checks that commitments for custom CoW AMM of CoW AMM orders are reset.
"""
# pylint: disable=duplicate-code
from typing import Any
Expand All @@ -17,9 +17,11 @@


class CoWAMMCommitmentTest(BaseTest):
"""
This test checks whether the Uniform Directed Prices constraint,
as introduced in CIP-38, is satisfied.
"""Checks that commitments for custom CoW AMM of CoW AMM orders are reset
Whenever a preinteraction calling the commit functinon of the (old) CoW AMM smart contract is
called, the currently commit order on the corresponding CoW AMM is checked. If the commited
order is not equal to the default order, the commitment was not reset.
"""

def __init__(self) -> None:
Expand All @@ -31,9 +33,15 @@ def __init__(self) -> None:
)

def check_commitments(self, settlement: dict[str, Any]) -> bool:
"""
This function checks whether there are multiple orders in the same directed token pair,
and if so, checks whether UDP is satisfied.
"""Checks the commitment of CoW AMM orders.
If there is a preinteraction with a call to the commit function of the CoW AMM contant
product smart contract, the commitment of that AMM is checked at the current point in
time.
This is not a check for including a commit in post interactions or within interactions.
It also does not check if the uncommit happened immediately, but just checks if the
current commitment is to the default order.
"""
# iterate over pre-interactions
for interaction in settlement["interactions"][0]:
Expand Down Expand Up @@ -80,8 +88,8 @@ def get_commitment(self, cowamm: str) -> str | None:

def run(self, tx_hash: str) -> bool:
"""
Wrapper function for the whole test. Checks if violation is more than
UDP_SENSITIVITY_THRESHOLD, in which case it generates an alert.
Wrapper function for the whole test. Checks that commitments for custom CoW AMM of CoW
AMM orders are reset
"""

transaction = self.web3_api.get_transaction(tx_hash)
Expand Down

0 comments on commit be7efc8

Please sign in to comment.