diff --git a/src/fetch/ipfs.py b/src/fetch/ipfs.py index bd4dec11..259224dd 100644 --- a/src/fetch/ipfs.py +++ b/src/fetch/ipfs.py @@ -61,7 +61,7 @@ def get_content(self, max_retries: int = 3) -> Optional[Any]: return None @classmethod - async def fetch_many( + async def fetch_many( # pylint: disable=too-many-locals cls, missing_rows: list[dict[str, str]], max_retries: int = 3 ) -> tuple[list[FoundContent], list[NotFoundContent]]: """Async AppData Fetching""" @@ -97,6 +97,9 @@ async def fetch_many( break except asyncio.TimeoutError: attempts += 1 + except aiohttp.ContentTypeError as err: + log.warning(f"failed to parse response {response} with {err}") + attempts += 1 if not content: total_attempts = previous_attempts + max_retries diff --git a/src/models/order_rewards_schema.py b/src/models/order_rewards_schema.py index 59cc000e..47c040d5 100644 --- a/src/models/order_rewards_schema.py +++ b/src/models/order_rewards_schema.py @@ -24,7 +24,6 @@ def from_pdf_to_dune_records(cls, rewards_df: DataFrame) -> list[dict[str, Any]] "data": { "surplus_fee": str(row["surplus_fee"]), "amount": float(row["amount"]), - "safe_liquidity": row["safe_liquidity"], }, } for row in rewards_df.to_dict(orient="records") diff --git a/src/sql/orderbook/order_rewards.sql b/src/sql/orderbook/order_rewards.sql index e97d7f29..b422558e 100644 --- a/src/sql/orderbook/order_rewards.sql +++ b/src/sql/orderbook/order_rewards.sql @@ -24,13 +24,7 @@ select concat('0x', encode(trade_hashes.order_uid, 'hex')) as order_uid, concat('0x', encode(solver, 'hex')) as solver, concat('0x', encode(tx_hash, 'hex')) as tx_hash, coalesce(surplus_fee, 0)::text as surplus_fee, - coalesce(reward, 0.0) as amount, - -- An order is a liquidity order if and only if reward is null. - -- A liquidity order is safe if and only if its fee_amount is > 0 - case - when reward is null and fee_amount > 0 then True - when reward is null and fee_amount = 0 then False - end as safe_liquidity + coalesce(reward, 0.0) as amount from trade_hashes left outer join order_execution o on trade_hashes.order_uid = o.order_uid diff --git a/tests/integration/test_fetch_orderbook.py b/tests/integration/test_fetch_orderbook.py index d57f7809..88a482fd 100644 --- a/tests/integration/test_fetch_orderbook.py +++ b/tests/integration/test_fetch_orderbook.py @@ -34,7 +34,6 @@ def test_get_order_rewards(self): ], "surplus_fee": ["0", "0"], "amount": [40.70410, 39.00522], - "safe_liquidity": [None, None], } ) diff --git a/tests/unit/test_order_rewards_schema.py b/tests/unit/test_order_rewards_schema.py index b1544e34..a68e94dc 100644 --- a/tests/unit/test_order_rewards_schema.py +++ b/tests/unit/test_order_rewards_schema.py @@ -14,7 +14,6 @@ def test_order_rewards_transformation(self): "tx_hash": ["0x71", "0x72", "0x73"], "surplus_fee": [12345678910111213, 0, 0], "amount": [40.70410, 39.00522, 0], - "safe_liquidity": [None, True, False], } ) @@ -27,7 +26,6 @@ def test_order_rewards_transformation(self): "data": { "surplus_fee": "12345678910111213", "amount": 40.70410, - "safe_liquidity": None, }, }, { @@ -37,7 +35,6 @@ def test_order_rewards_transformation(self): "data": { "surplus_fee": "0", "amount": 39.00522, - "safe_liquidity": True, }, }, { @@ -47,7 +44,6 @@ def test_order_rewards_transformation(self): "data": { "surplus_fee": "0", "amount": 0.0, - "safe_liquidity": False, }, }, ],