Skip to content

Commit 4c6d1e2

Browse files
committed
support better search and tag derivation via pubkey
1 parent 77a1b76 commit 4c6d1e2

File tree

18 files changed

+2398
-1991
lines changed

18 files changed

+2398
-1991
lines changed

clients/python/docs/AddressTag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Name | Type | Description | Notes
2121
**lastmod** | **int** | Last modified | [optional]
2222
**confidence** | **str** | Confidence name | [optional]
2323
**confidence_level** | **int** | Confidence level | [optional]
24-
**inherited_from** | **str** | if the tag was inherited from cluster | [optional] if omitted the server will use the default value of "cluster"
24+
**inherited_from** | **str** | if the tag was inherited from cluster | [optional]
2525
**entity** | **int** | Entity id | [optional]
2626
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
2727

clients/python/docs/LabelSummary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Name | Type | Description | Notes
1212
**sources** | **[str]** | |
1313
**concepts** | **[str]** | |
1414
**lastmod** | **int** | |
15-
**inherited_from** | **str** | if the tag was inherited from cluster | [optional] if omitted the server will use the default value of "cluster"
15+
**inherited_from** | **str** | if the tag was inherited from cluster | [optional]
1616
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
1717

1818
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

clients/python/docs/Tag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Name | Type | Description | Notes
2020
**lastmod** | **int** | Last modified | [optional]
2121
**confidence** | **str** | Confidence name | [optional]
2222
**confidence_level** | **int** | Confidence level | [optional]
23-
**inherited_from** | **str** | if the tag was inherited from cluster | [optional] if omitted the server will use the default value of "cluster"
23+
**inherited_from** | **str** | if the tag was inherited from cluster | [optional]
2424
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
2525

2626
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

clients/python/graphsense/model/address_tag.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class AddressTag(ModelComposed):
6363
allowed_values = {
6464
('inherited_from',): {
6565
'CLUSTER': "cluster",
66+
'PUBKEY': "pubkey",
67+
'PUBKEY_AND_CLUSTER': "pubkey_and_cluster",
6668
},
6769
}
6870

@@ -196,7 +198,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
196198
lastmod (int): Last modified. [optional] # noqa: E501
197199
confidence (str): Confidence name. [optional] # noqa: E501
198200
confidence_level (int): Confidence level. [optional] # noqa: E501
199-
inherited_from (str): if the tag was inherited from cluster. [optional] if omitted the server will use the default value of "cluster" # noqa: E501
201+
inherited_from (str): if the tag was inherited from cluster. [optional] # noqa: E501
200202
entity (int): Entity id. [optional] # noqa: E501
201203
"""
202204

@@ -314,7 +316,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
314316
lastmod (int): Last modified. [optional] # noqa: E501
315317
confidence (str): Confidence name. [optional] # noqa: E501
316318
confidence_level (int): Confidence level. [optional] # noqa: E501
317-
inherited_from (str): if the tag was inherited from cluster. [optional] if omitted the server will use the default value of "cluster" # noqa: E501
319+
inherited_from (str): if the tag was inherited from cluster. [optional] # noqa: E501
318320
entity (int): Entity id. [optional] # noqa: E501
319321
"""
320322

clients/python/graphsense/model/label_summary.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class LabelSummary(ModelNormal):
5757
allowed_values = {
5858
('inherited_from',): {
5959
'CLUSTER': "cluster",
60+
'PUBKEY': "pubkey",
61+
'PUBKEY_AND_CLUSTER': "pubkey_and_cluster",
6062
},
6163
}
6264

@@ -163,7 +165,7 @@ def _from_openapi_data(cls, label, count, confidence, relevance, creators, sourc
163165
Animal class but this time we won't travel
164166
through its discriminator because we passed in
165167
_visited_composed_classes = (Animal,)
166-
inherited_from (str): if the tag was inherited from cluster. [optional] if omitted the server will use the default value of "cluster" # noqa: E501
168+
inherited_from (str): if the tag was inherited from cluster. [optional] # noqa: E501
167169
"""
168170

169171
_check_type = kwargs.pop('_check_type', True)
@@ -263,7 +265,7 @@ def __init__(self, label, count, confidence, relevance, creators, sources, conce
263265
Animal class but this time we won't travel
264266
through its discriminator because we passed in
265267
_visited_composed_classes = (Animal,)
266-
inherited_from (str): if the tag was inherited from cluster. [optional] if omitted the server will use the default value of "cluster" # noqa: E501
268+
inherited_from (str): if the tag was inherited from cluster. [optional] # noqa: E501
267269
"""
268270

269271
_check_type = kwargs.pop('_check_type', True)

clients/python/graphsense/model/tag.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class Tag(ModelNormal):
5757
allowed_values = {
5858
('inherited_from',): {
5959
'CLUSTER': "cluster",
60+
'PUBKEY': "pubkey",
61+
'PUBKEY_AND_CLUSTER': "pubkey_and_cluster",
6062
},
6163
}
6264

@@ -187,7 +189,7 @@ def _from_openapi_data(cls, label, tagpack_title, tagpack_is_public, tagpack_cre
187189
lastmod (int): Last modified. [optional] # noqa: E501
188190
confidence (str): Confidence name. [optional] # noqa: E501
189191
confidence_level (int): Confidence level. [optional] # noqa: E501
190-
inherited_from (str): if the tag was inherited from cluster. [optional] if omitted the server will use the default value of "cluster" # noqa: E501
192+
inherited_from (str): if the tag was inherited from cluster. [optional] # noqa: E501
191193
"""
192194

193195
_check_type = kwargs.pop('_check_type', True)
@@ -294,7 +296,7 @@ def __init__(self, label, tagpack_title, tagpack_is_public, tagpack_creator, is_
294296
lastmod (int): Last modified. [optional] # noqa: E501
295297
confidence (str): Confidence name. [optional] # noqa: E501
296298
confidence_level (int): Confidence level. [optional] # noqa: E501
297-
inherited_from (str): if the tag was inherited from cluster. [optional] if omitted the server will use the default value of "cluster" # noqa: E501
299+
inherited_from (str): if the tag was inherited from cluster. [optional] # noqa: E501
298300
"""
299301

300302
_check_type = kwargs.pop('_check_type', True)

gsrest/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class GSRestConfig(BaseSettings):
5454
address_links_request_timeout: float = Field(
5555
default=30, description="Timeout for address links requests endpoint"
5656
)
57+
include_pubkey_derived_tags: bool = Field(
58+
default=True,
59+
description="Include pubkey derived tags in tag summaries and lists",
60+
)
5761
user_tag_reporting_acl_group: str = Field(
5862
default="develop",
5963
alias="user-tag-reporting-acl-group",
@@ -64,6 +68,10 @@ class GSRestConfig(BaseSettings):
6468
alias="enable-user-tag-reporting",
6569
description="Enable user tag reporting functionality",
6670
)
71+
privacy_preserving_tag_notifications: bool = Field(
72+
default=True,
73+
description="Enable privacy preserving tag notifications",
74+
)
6775
included_bridges: Tuple[str, ...] = Field(
6876
default_factory=tuple,
6977
description="Included bridges in tx conversions",

gsrest/dependencies.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def __init__(
9090
)
9191
self._entities_service = EntitiesService(
9292
db=db,
93-
tagstore=self.tagstore_db,
9493
tags_service=self._tags_service,
9594
blocks_service=self._blocks_service,
9695
rates_service=self._rates_service,
@@ -99,7 +98,6 @@ def __init__(
9998

10099
self._addresses_service = AddressesService(
101100
db=db,
102-
tagstore=self.tagstore_db,
103101
tags_service=self._tags_service,
104102
entities_service=self._entities_service,
105103
blocks_service=self._blocks_service,

gsrest/service/addresses_service.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ async def get_tag_summary_by_address(
4444
):
4545
services = get_service_container(request)
4646
tagstore_groups = get_tagstore_access_groups(request)
47+
include_pubkey_derived_tags = request.app["config"].include_pubkey_derived_tags
4748

4849
pydantic_result = await services.addresses_service.get_tag_summary_by_address(
49-
currency, address, tagstore_groups, include_best_cluster_tag
50+
currency,
51+
address,
52+
tagstore_groups,
53+
include_best_cluster_tag,
54+
include_pubkey_derived_tags=include_pubkey_derived_tags,
5055
)
5156

5257
return pydantic_to_openapi(pydantic_result)
@@ -69,6 +74,7 @@ async def list_tags_by_address(
6974
services = get_service_container(request)
7075
tagstore_groups = get_tagstore_access_groups(request)
7176
cache = get_request_cache(request)
77+
include_pubkey_derived_tags = request.app["config"].include_pubkey_derived_tags
7278

7379
pydantic_result = await services.addresses_service.list_tags_by_address(
7480
currency,
@@ -78,6 +84,7 @@ async def list_tags_by_address(
7884
page,
7985
pagesize,
8086
include_best_cluster_tag,
87+
include_pubkey_derived_tags=include_pubkey_derived_tags,
8188
)
8289

8390
return pydantic_to_openapi(pydantic_result)

gsrest/test/tags_service.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from openapi_server.models.address_tag import AddressTag
2-
from openapi_server.models.address_tags import AddressTags
32
from openapi_server.models.concept import Concept
43

54
base_tagpack_src = ""
@@ -415,10 +414,12 @@ async def list_address_tags(test_case):
415414
path_with_page, label="isolinks", pagesize=1, page=result["next_page"]
416415
)
417416
assert [t2] == result["address_tags"]
418-
result = await test_case.request(
419-
path_with_page, label="isolinks", pagesize=1, page=result["next_page"]
420-
)
421-
test_case.assertEqual(AddressTags(address_tags=[]).to_dict(), result)
417+
418+
assert result.get("next_page") is None
419+
# result = await test_case.request(
420+
# path_with_page, label="isolinks", pagesize=1, page=result["next_page"]
421+
# )
422+
# test_case.assertEqual(AddressTags(address_tags=[]).to_dict(), result)
422423

423424
result = await test_case.request(path, label="TagA")
424425
assert [eth_tag3.to_dict()] == result["address_tags"]

0 commit comments

Comments
 (0)