diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml
index 6302260..4326509 100644
--- a/.github/workflows/pull_request.yaml
+++ b/.github/workflows/pull_request.yaml
@@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - name: Setup Python 3.10
+ - name: Setup Python 3.12
uses: actions/setup-python@v3
with:
- python-version: '3.10'
+ python-version: '3.12'
- name: Install Requirements
run:
pip install -r requirements.txt
diff --git a/Dockerfile b/Dockerfile
index 83f765f..afaa66a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.11
+FROM python:3.12
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
COPY . .
diff --git a/README.md b/README.md
index ed8a5b6..8a49d3e 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Clone Repository:
git clone https://github.com/cowprotocol/ebbo.git
-Version python 3.10 is used.
+Version python 3.12 is used.
### Dependencies:
diff --git a/requirements.txt b/requirements.txt
index 342be59..e8df969 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,10 @@
-black==23.3.0
-mypy==1.4.1
-pylint==2.17.4
-pytest==7.4.0
-python-dotenv>=0.20.0
-web3==6.5.0
-types-requests
+black
dune-client
-hexbytes~=0.3.1
-requests~=2.31.0
+hexbytes
+mypy
+pylint
+pytest
+python-dotenv
+requests
+types-requests
+web3
diff --git a/src/apis/auctioninstanceapi.py b/src/apis/auctioninstanceapi.py
index 7f65d9f..e563b70 100644
--- a/src/apis/auctioninstanceapi.py
+++ b/src/apis/auctioninstanceapi.py
@@ -1,6 +1,7 @@
"""
API for fetching auction instances from AWS.
"""
+
# pylint: disable=logging-fstring-interpolation
from typing import Any, Optional
diff --git a/src/apis/coingeckoapi.py b/src/apis/coingeckoapi.py
index b3b50c3..d646f3a 100644
--- a/src/apis/coingeckoapi.py
+++ b/src/apis/coingeckoapi.py
@@ -1,6 +1,7 @@
"""
CoingeckoAPI for fetching the price in usd of a given token.
"""
+
# pylint: disable=logging-fstring-interpolation
from typing import Optional
diff --git a/src/apis/orderbookapi.py b/src/apis/orderbookapi.py
index f8a0054..7f7af86 100644
--- a/src/apis/orderbookapi.py
+++ b/src/apis/orderbookapi.py
@@ -1,6 +1,7 @@
"""
OrderbookAPI for fetching relevant data using the CoW Swap Orderbook API.
"""
+
# pylint: disable=logging-fstring-interpolation
from typing import Any, Optional
diff --git a/src/apis/solverapi.py b/src/apis/solverapi.py
index f0aa545..c22f01e 100644
--- a/src/apis/solverapi.py
+++ b/src/apis/solverapi.py
@@ -1,6 +1,7 @@
"""
API for calling an http solver with auction instances.
"""
+
# pylint: disable=logging-fstring-interpolation
from os import getenv
diff --git a/src/apis/tenderlyapi.py b/src/apis/tenderlyapi.py
index 8c978e4..2cdcc52 100644
--- a/src/apis/tenderlyapi.py
+++ b/src/apis/tenderlyapi.py
@@ -1,6 +1,7 @@
"""
TenderlyAPI for simulating transactions on tenderly.
"""
+
# pylint: disable=logging-fstring-interpolation
from os import getenv
diff --git a/src/apis/tokenlistapi.py b/src/apis/tokenlistapi.py
index ed415af..6faf75d 100644
--- a/src/apis/tokenlistapi.py
+++ b/src/apis/tokenlistapi.py
@@ -1,6 +1,7 @@
"""
TokenListAPI for fetching a curated token list.
"""
+
# pylint: disable=logging-fstring-interpolation
from typing import Optional
import requests
diff --git a/src/apis/web3api.py b/src/apis/web3api.py
index f475f11..4664cc6 100644
--- a/src/apis/web3api.py
+++ b/src/apis/web3api.py
@@ -1,6 +1,7 @@
"""
Web3API for fetching relevant data using the web3 library.
"""
+
# pylint: disable=logging-fstring-interpolation
from os import getenv
@@ -139,7 +140,7 @@ def get_settlement(self, transaction: TxData) -> dict[str, Any]:
"""
Decode settlement from transaction using the settlement contract.
"""
- return self.get_settlement_from_calldata(transaction["input"])
+ return self.get_settlement_from_calldata(transaction["input"].hex())
def get_settlement_from_calldata(self, calldata: str) -> dict[str, Any]:
"""
diff --git a/src/daemon.py b/src/daemon.py
index 7e8c7af..7bb29d2 100644
--- a/src/daemon.py
+++ b/src/daemon.py
@@ -4,6 +4,7 @@
If a settlement failes a test, an error level message is logged.
"""
+
# pylint: disable=logging-fstring-interpolation
import time
diff --git a/src/helper_functions.py b/src/helper_functions.py
index a211307..bb800df 100644
--- a/src/helper_functions.py
+++ b/src/helper_functions.py
@@ -1,6 +1,7 @@
"""
This file contains some auxiliary functions
"""
+
from __future__ import annotations
import logging
from typing import Optional
diff --git a/src/models.py b/src/models.py
index 3034576..53f7178 100644
--- a/src/models.py
+++ b/src/models.py
@@ -1,6 +1,7 @@
"""
Definition of trades, orders, and executions.
"""
+
from __future__ import annotations
from fractions import Fraction
from dataclasses import dataclass
diff --git a/src/monitoring_tests/base_test.py b/src/monitoring_tests/base_test.py
index 7e366e5..05c4ece 100644
--- a/src/monitoring_tests/base_test.py
+++ b/src/monitoring_tests/base_test.py
@@ -2,6 +2,7 @@
In this file, we introduce the BaseTest class, whose purpose is to be used as the basis
for all tests developed.
"""
+
# pylint: disable=logging-fstring-interpolation
from abc import ABC, abstractmethod
diff --git a/src/monitoring_tests/buffers_monitoring_test.py b/src/monitoring_tests/buffers_monitoring_test.py
index b7115a0..0cdeb5e 100644
--- a/src/monitoring_tests/buffers_monitoring_test.py
+++ b/src/monitoring_tests/buffers_monitoring_test.py
@@ -2,6 +2,7 @@
Checks the value of buffers every 150 settlements by invoking
the ehtplorer api, and in some cases, coingecko.
"""
+
# pylint: disable=logging-fstring-interpolation
import requests
from src.monitoring_tests.base_test import BaseTest
@@ -55,9 +56,7 @@ def compute_buffers_value(self) -> bool:
decimals = int(token["tokenInfo"]["decimals"])
if token["tokenInfo"]["price"] is not False:
price_in_usd = token["tokenInfo"]["price"]["rate"]
- token_buffer_value_in_usd = (
- balance / 10**decimals
- ) * price_in_usd
+ token_buffer_value_in_usd = (balance / 10**decimals) * price_in_usd
# in case some price is way off and it blows a lot the total value held in the
# smart contract we use a second price feed, from coingecko, to correct in case
# the initial price is indeed off
@@ -70,8 +69,9 @@ def compute_buffers_value(self) -> bool:
coingecko_value_in_usd = (
balance / 10**decimals
) * coingecko_price_in_usd
- if coingecko_value_in_usd < token_buffer_value_in_usd:
- token_buffer_value_in_usd = coingecko_value_in_usd
+ token_buffer_value_in_usd = min(
+ token_buffer_value_in_usd, coingecko_value_in_usd
+ )
value_in_usd += token_buffer_value_in_usd
log_output = f"Buffer value is {value_in_usd} USD"
if value_in_usd > BUFFERS_VALUE_USD_THRESHOLD:
diff --git a/src/monitoring_tests/cost_coverage_zero_signed_fee.py b/src/monitoring_tests/cost_coverage_zero_signed_fee.py
index 8c52557..be0ed8e 100644
--- a/src/monitoring_tests/cost_coverage_zero_signed_fee.py
+++ b/src/monitoring_tests/cost_coverage_zero_signed_fee.py
@@ -1,6 +1,7 @@
"""
Computing cost coverage per solver.
"""
+
# pylint: disable=logging-fstring-interpolation
from typing import Any, Dict
diff --git a/src/monitoring_tests/cowamm_commitment_test.py b/src/monitoring_tests/cowamm_commitment_test.py
index 2ba9b31..63651be 100644
--- a/src/monitoring_tests/cowamm_commitment_test.py
+++ b/src/monitoring_tests/cowamm_commitment_test.py
@@ -1,6 +1,7 @@
"""
Checks that commitments for custom CoW AMM of CoW AMM orders are reset.
"""
+
# pylint: disable=duplicate-code
from typing import Any
diff --git a/src/monitoring_tests/mev_blocker_kickbacks_test.py b/src/monitoring_tests/mev_blocker_kickbacks_test.py
index e5573a0..81db89f 100644
--- a/src/monitoring_tests/mev_blocker_kickbacks_test.py
+++ b/src/monitoring_tests/mev_blocker_kickbacks_test.py
@@ -3,6 +3,7 @@
It generates an alert when kickbacks due to a specific settlement are
more than KICKBACKS_ALERT_THRESHOLD
"""
+
# pylint: disable=logging-fstring-interpolation
from src.monitoring_tests.base_test import BaseTest
from src.apis.web3api import Web3API
diff --git a/src/monitoring_tests/partially_fillable_cost_coverage_test.py b/src/monitoring_tests/partially_fillable_cost_coverage_test.py
index 0364170..390c704 100644
--- a/src/monitoring_tests/partially_fillable_cost_coverage_test.py
+++ b/src/monitoring_tests/partially_fillable_cost_coverage_test.py
@@ -1,6 +1,7 @@
"""
Cost coverage test for partially fillable orders.
"""
+
# pylint: disable=logging-fstring-interpolation
from web3.types import TxData, TxReceipt
diff --git a/src/monitoring_tests/reference_solver_surplus_test.py b/src/monitoring_tests/reference_solver_surplus_test.py
index c28cd60..a2d1c21 100644
--- a/src/monitoring_tests/reference_solver_surplus_test.py
+++ b/src/monitoring_tests/reference_solver_surplus_test.py
@@ -1,6 +1,7 @@
"""
Comparing order surplus to a reference solution.
"""
+
# pylint: disable=logging-fstring-interpolation
# pylint: disable=duplicate-code
diff --git a/src/monitoring_tests/solver_competition_surplus_test.py b/src/monitoring_tests/solver_competition_surplus_test.py
index 20f372b..6840429 100644
--- a/src/monitoring_tests/solver_competition_surplus_test.py
+++ b/src/monitoring_tests/solver_competition_surplus_test.py
@@ -1,6 +1,7 @@
"""
Comparing order surplus accross different solutions.
"""
+
# pylint: disable=logging-fstring-interpolation
from typing import Any
diff --git a/src/monitoring_tests/uniform_directed_prices_test.py b/src/monitoring_tests/uniform_directed_prices_test.py
index 9142b01..bdee44b 100644
--- a/src/monitoring_tests/uniform_directed_prices_test.py
+++ b/src/monitoring_tests/uniform_directed_prices_test.py
@@ -1,6 +1,7 @@
"""
Checks the uniform directed prices constraint that was introduced with CIP-38
"""
+
# pylint: disable=duplicate-code
from typing import Any
from fractions import Fraction
diff --git a/tests/e2e/test.py b/tests/e2e/test.py
index 43a1b23..9ee46f8 100644
--- a/tests/e2e/test.py
+++ b/tests/e2e/test.py
@@ -1,6 +1,7 @@
"""
File to run historical block/hash testing for EBBO
"""
+
import unittest
from src.monitoring_tests.competition_endpoint_test.endpoint_test import EndpointTest
from src.monitoring_tests.fee_monitoring.fee_monitoring import FeeMonitoring