Skip to content

Commit 4d27180

Browse files
authored
Release 2025-09-XX (#3571)
2 parents 81c96e8 + e253512 commit 4d27180

File tree

8 files changed

+31
-26
lines changed

8 files changed

+31
-26
lines changed

packages/apps/job-launcher/server/src/common/constants/payment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import { ITokenId } from '../interfaces';
33
export const CoingeckoTokenId: ITokenId = {
44
hmt: 'human-protocol',
55
usdt: 'tether',
6+
usdt0: 'usdt0',
67
usdc: 'usd-coin',
78
};

packages/apps/job-launcher/server/src/common/constants/tokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const TOKEN_ADDRESSES: {
4949
address: NETWORKS[ChainId.POLYGON]!.hmtAddress,
5050
decimals: 18,
5151
},
52-
[EscrowFundToken.USDT]: {
52+
[EscrowFundToken.USDT0]: {
5353
address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',
5454
decimals: 6,
5555
},

packages/apps/job-launcher/server/src/common/enums/job.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,5 +455,6 @@ export enum WorkerBrowser {
455455
export enum EscrowFundToken {
456456
HMT = 'hmt',
457457
USDT = 'usdt',
458+
USDT0 = 'usdt0',
458459
USDC = 'usdc',
459460
}

packages/apps/job-launcher/server/src/modules/payment/payment.service.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,7 @@ describe('PaymentService', () => {
13171317
{ currency: PaymentCurrency.USD, amount: 100 },
13181318
{ currency: PaymentCurrency.HMT, amount: 50 },
13191319
{ currency: PaymentCurrency.USDT, amount: 0 },
1320+
{ currency: PaymentCurrency.USDT0, amount: 0 },
13201321
{ currency: PaymentCurrency.USDC, amount: 0 },
13211322
],
13221323
totalUsdAmount: 150,
@@ -1336,8 +1337,8 @@ describe('PaymentService', () => {
13361337
const balance = await paymentService.getUserBalance(userId);
13371338

13381339
expect(balance).toEqual(expectedBalance);
1339-
expect(paymentService.getUserBalanceByCurrency).toHaveBeenCalledTimes(4);
1340-
expect(paymentService.convertToUSD).toHaveBeenCalledTimes(4);
1340+
expect(paymentService.getUserBalanceByCurrency).toHaveBeenCalledTimes(5);
1341+
expect(paymentService.convertToUSD).toHaveBeenCalledTimes(5);
13411342
});
13421343

13431344
it('should return zero balance for new users', async () => {
@@ -1347,6 +1348,7 @@ describe('PaymentService', () => {
13471348
{ currency: PaymentCurrency.USD, amount: 0 },
13481349
{ currency: PaymentCurrency.HMT, amount: 0 },
13491350
{ currency: PaymentCurrency.USDT, amount: 0 },
1351+
{ currency: PaymentCurrency.USDT0, amount: 0 },
13501352
{ currency: PaymentCurrency.USDC, amount: 0 },
13511353
],
13521354
totalUsdAmount: 0,
@@ -1366,8 +1368,8 @@ describe('PaymentService', () => {
13661368
const balance = await paymentService.getUserBalance(userId);
13671369

13681370
expect(balance).toEqual(expectedBalance);
1369-
expect(paymentService.getUserBalanceByCurrency).toHaveBeenCalledTimes(4);
1370-
expect(paymentService.convertToUSD).toHaveBeenCalledTimes(4);
1371+
expect(paymentService.getUserBalanceByCurrency).toHaveBeenCalledTimes(5);
1372+
expect(paymentService.convertToUSD).toHaveBeenCalledTimes(5);
13711373
});
13721374
});
13731375

packages/examples/cvat/exchange-oracle/debug.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,20 @@ def patched_get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
6666
logger.debug(f"DEV: Local manifests: {format_sequence(minio_manifests)}")
6767

6868
candidate_files = [
69-
fn for fn in minio_manifests if PurePosixPath(fn).name == f"{escrow_address}.json"
69+
fn
70+
for fn in minio_manifests
71+
if (
72+
"/" in escrow_address
73+
and fn == f"{escrow_address}.json"
74+
or PurePosixPath(fn).name == f"{escrow_address}.json"
75+
)
7076
]
7177
if not candidate_files:
7278
return original_get_escrow(ChainId(chain_id), escrow_address)
7379
elif len(candidate_files) != 1:
7480
raise Exception(
7581
"Can't select local manifest to be used for escrow '{}'"
76-
" - several manifests math: {}".format(
82+
" - several manifests match: {}".format(
7783
escrow_address, format_sequence(candidate_files)
7884
)
7985
)
@@ -92,7 +98,7 @@ def patched_get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
9298
token="HMT", # noqa: S106
9399
total_funded_amount=10,
94100
created_at=datetime.datetime(2023, 1, 1, tzinfo=datetime.timezone.utc),
95-
manifest_url=(f"http://{Config.storage_config.endpoint_url}/manifests/{manifest_file}"),
101+
manifest=(f"http://{Config.storage_config.endpoint_url}/manifests/{manifest_file}"),
96102
)
97103

98104
logger.info(f"DEV: Using local manifest '{manifest_file}' for escrow '{escrow_address}'")

packages/examples/cvat/exchange-oracle/src/crons/cvat/state_trackers.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
from contextlib import suppress
32

43
from sqlalchemy.orm import Session
54

@@ -31,7 +30,7 @@ def process_incoming_cvat_webhooks(logger: logging.Logger, session: Session) ->
3130

3231
for webhook in webhooks:
3332
try:
34-
with session.begin_nested():
33+
with session.begin_nested(), db.suppress(db_errors.LockNotAvailable):
3534
cvat_webhook_handler(webhook, session)
3635
cvat_service.incoming_webhooks.handle_webhook_success(
3736
session, webhook_id=webhook.id
@@ -131,10 +130,7 @@ def _reset_job_after_assignment(session: Session, assignment: cvat_models.Assign
131130
)
132131

133132
for assignment in assignments:
134-
with (
135-
session.begin_nested(),
136-
suppress(db_errors.LockNotAvailable),
137-
):
133+
with session.begin_nested(), db.suppress(db_errors.LockNotAvailable):
138134
cvat_service.get_jobs_by_cvat_id(
139135
session,
140136
cvat_ids=[assignment.cvat_job_id],
@@ -161,10 +157,7 @@ def _reset_job_after_assignment(session: Session, assignment: cvat_models.Assign
161157
)
162158

163159
for assignment in assignments:
164-
with (
165-
session.begin_nested(),
166-
suppress(db_errors.LockNotAvailable),
167-
):
160+
with session.begin_nested(), db.suppress(db_errors.LockNotAvailable):
168161
cvat_service.get_jobs_by_cvat_id(
169162
session,
170163
cvat_ids=[assignment.cvat_job_id],
@@ -189,10 +182,7 @@ def _reset_job_after_assignment(session: Session, assignment: cvat_models.Assign
189182

190183
for assignment in assignments:
191184
if assignment.job.project.status != ProjectStatuses.annotation:
192-
with (
193-
session.begin_nested(),
194-
suppress(db_errors.LockNotAvailable),
195-
):
185+
with session.begin_nested(), db.suppress(db_errors.LockNotAvailable):
196186
cvat_service.get_jobs_by_cvat_id(
197187
session,
198188
cvat_ids=[assignment.cvat_job_id],

packages/examples/cvat/exchange-oracle/src/db/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from contextlib import contextmanager
22
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar
3-
from uuid import uuid4
43

54
import sqlalchemy
65
from psycopg2.errors import Error

packages/examples/cvat/recording-oracle/debug.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,20 @@ def patched_get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
3232
logger.debug(f"DEV: Local manifests: {format_sequence(minio_manifests)}")
3333

3434
candidate_files = [
35-
fn for fn in minio_manifests if PurePosixPath(fn).name == f"{escrow_address}.json"
35+
fn
36+
for fn in minio_manifests
37+
if (
38+
"/" in escrow_address
39+
and fn == f"{escrow_address}.json"
40+
or PurePosixPath(fn).name == f"{escrow_address}.json"
41+
)
3642
]
3743
if not candidate_files:
3844
return original_get_escrow(ChainId(chain_id), escrow_address)
3945
if len(candidate_files) != 1:
4046
raise Exception(
4147
f"Can't select local manifest to be used for escrow '{escrow_address}'"
42-
f" - several manifests math: {format_sequence(candidate_files)}"
48+
f" - several manifests match: {format_sequence(candidate_files)}"
4349
)
4450

4551
manifest_file = candidate_files[0]
@@ -56,7 +62,7 @@ def patched_get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
5662
token="HMT", # noqa: S106
5763
total_funded_amount=10,
5864
created_at=datetime.datetime(2023, 1, 1, tzinfo=datetime.timezone.utc),
59-
manifest_url=(f"http://{Config.storage_config.endpoint_url}/manifests/{manifest_file}"),
65+
manifest=(f"http://{Config.storage_config.endpoint_url}/manifests/{manifest_file}"),
6066
)
6167

6268
logger.info(f"DEV: Using local manifest '{manifest_file}' for escrow '{escrow_address}'")

0 commit comments

Comments
 (0)