From 926fd1710fbb8017877540688a11d357830e9f8d Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 5 Oct 2023 04:02:08 +1100
Subject: [PATCH 01/23] removed some private fileds from nodemetadataJSON
---
.../syft/src/syft/service/metadata/node_metadata.py | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index d3b03e71c1a..58df8081771 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -75,9 +75,9 @@ class NodeMetadata(SyftObject):
organization: str = "OpenMined"
on_board: bool = False
description: str = "Text"
- signup_enabled: bool
- admin_email: str
- node_side_type: str
+ signup_enabled: Optional[bool]
+ admin_email: Optional[str]
+ node_side_type: Optional[str]
show_warnings: bool
def check_version(self, client_version: str) -> bool:
@@ -98,13 +98,9 @@ class NodeMetadataJSON(BaseModel, StorableObjectType):
lowest_object_version: int
syft_version: str
node_type: str = NodeType.DOMAIN.value
- deployed_on: str = "Date"
organization: str = "OpenMined"
- on_board: bool = False
description: str = "My cool domain"
- signup_enabled: bool
- admin_email: str
- node_side_type: str
+ # node_side_type: str
show_warnings: bool
def check_version(self, client_version: str) -> bool:
From 372a69f66b249d6d04b24fadd0972f9e2363d8ae Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 5 Oct 2023 04:15:31 +1100
Subject: [PATCH 02/23] removed a change that wasn't needed to a field
---
packages/syft/src/syft/service/metadata/node_metadata.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 58df8081771..5c6ad7997e2 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -77,7 +77,7 @@ class NodeMetadata(SyftObject):
description: str = "Text"
signup_enabled: Optional[bool]
admin_email: Optional[str]
- node_side_type: Optional[str]
+ node_side_type: str
show_warnings: bool
def check_version(self, client_version: str) -> bool:
From aea3dcca636e4509fea0c602218d1de59a740ea8 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 5 Oct 2023 04:17:50 +1100
Subject: [PATCH 03/23] readded node_side_type field
---
packages/syft/src/syft/service/metadata/node_metadata.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 5c6ad7997e2..48be19cfe41 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -100,7 +100,7 @@ class NodeMetadataJSON(BaseModel, StorableObjectType):
node_type: str = NodeType.DOMAIN.value
organization: str = "OpenMined"
description: str = "My cool domain"
- # node_side_type: str
+ node_side_type: str
show_warnings: bool
def check_version(self, client_version: str) -> bool:
From 08a25012501c8b6df1109a37c77a0c42f3293310 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 5 Oct 2023 16:01:59 +1100
Subject: [PATCH 04/23] removed assert signup_enabled check from notebook as no
longer exists
---
notebooks/api/0.8/07-domain-register-control-flow.ipynb | 1 -
1 file changed, 1 deletion(-)
diff --git a/notebooks/api/0.8/07-domain-register-control-flow.ipynb b/notebooks/api/0.8/07-domain-register-control-flow.ipynb
index ff319fa8ea3..1ed97a69e89 100644
--- a/notebooks/api/0.8/07-domain-register-control-flow.ipynb
+++ b/notebooks/api/0.8/07-domain-register-control-flow.ipynb
@@ -266,7 +266,6 @@
"metadata": {},
"outputs": [],
"source": [
- "assert root_client.metadata.signup_enabled == False\n",
"assert isinstance(response_1, sy.SyftSuccess)\n",
"assert isinstance(response_2, sy.SyftError)\n",
"assert isinstance(response_3, sy.SyftError)"
From 5f444ffda3fbbb0a79395162def45c85d01ffefa Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 5 Oct 2023 17:51:20 +1100
Subject: [PATCH 05/23] changed node check for signup_enabled from metadata to
client.setting
---
notebooks/api/0.8/07-domain-register-control-flow.ipynb | 1 +
1 file changed, 1 insertion(+)
diff --git a/notebooks/api/0.8/07-domain-register-control-flow.ipynb b/notebooks/api/0.8/07-domain-register-control-flow.ipynb
index 1ed97a69e89..7f15791d463 100644
--- a/notebooks/api/0.8/07-domain-register-control-flow.ipynb
+++ b/notebooks/api/0.8/07-domain-register-control-flow.ipynb
@@ -266,6 +266,7 @@
"metadata": {},
"outputs": [],
"source": [
+ "assert root_client.settings.get().signup_enabled == False\n",
"assert isinstance(response_1, sy.SyftSuccess)\n",
"assert isinstance(response_2, sy.SyftError)\n",
"assert isinstance(response_3, sy.SyftError)"
From e5b945c039b153f0af1a308c11ab08186bc24aac Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Mon, 9 Oct 2023 23:12:50 +1100
Subject: [PATCH 06/23] added setting property to node class that contains old
metadata info to be used by server
---
packages/syft/src/syft/node/node.py | 34 ++++++++-----------
.../syft/service/metadata/node_metadata.py | 7 ++--
.../syft/service/network/network_service.py | 8 +++++
.../syft/src/syft/service/network/routes.py | 2 +-
.../syft/src/syft/service/request/request.py | 4 +--
.../src/syft/service/settings/settings.py | 5 +++
.../src/syft/service/user/user_service.py | 2 +-
7 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py
index b4584bf6a6f..6d30e8f2c55 100644
--- a/packages/syft/src/syft/node/node.py
+++ b/packages/syft/src/syft/node/node.py
@@ -626,29 +626,28 @@ def _get_service_method_from_path(self, path: str) -> Callable:
return getattr(service_obj, method_name)
+ @property
+ def settings(self) -> NodeSettings:
+ settings_stash = SettingsStash(store=self.document_store)
+ settings = settings_stash.get_all(self.signing_key.verify_key)
+ if settings.is_ok() and len(settings.ok()) > 0:
+ settings_data = settings.ok()[0]
+ settings_data.verify_key = self.verify_key
+ return settings_data
+
@property
def metadata(self) -> NodeMetadata:
name = ""
- deployed_on = ""
organization = ""
- on_board = False
description = ""
signup_enabled = False
- admin_email = ""
show_warnings = self.enable_warnings
-
- settings_stash = SettingsStash(store=self.document_store)
- settings = settings_stash.get_all(self.signing_key.verify_key)
- if settings.is_ok() and len(settings.ok()) > 0:
- settings_data = settings.ok()[0]
- name = settings_data.name
- deployed_on = settings_data.deployed_on
- organization = settings_data.organization
- on_board = settings_data.on_board
- description = settings_data.description
- signup_enabled = settings_data.signup_enabled
- admin_email = settings_data.admin_email
- show_warnings = settings_data.show_warnings
+ settings_data = self.settings
+ name = settings_data.name
+ organization = settings_data.organization
+ description = settings_data.description
+ signup_enabled = settings_data.signup_enabled
+ show_warnings = settings_data.show_warnings
return NodeMetadata(
name=name,
@@ -657,13 +656,10 @@ def metadata(self) -> NodeMetadata:
highest_object_version=HIGHEST_SYFT_OBJECT_VERSION,
lowest_object_version=LOWEST_SYFT_OBJECT_VERSION,
syft_version=__version__,
- deployed_on=deployed_on,
description=description,
organization=organization,
- on_board=on_board,
node_type=self.node_type.value,
signup_enabled=signup_enabled,
- admin_email=admin_email,
node_side_type=self.node_side_type.value,
show_warnings=show_warnings,
)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 48be19cfe41..49f05baec33 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -56,7 +56,6 @@ class NodeMetadataUpdate(SyftObject):
highest_object_version: Optional[int]
lowest_object_version: Optional[int]
syft_version: Optional[str]
- admin_email: Optional[str]
@serializable()
@@ -71,12 +70,8 @@ class NodeMetadata(SyftObject):
lowest_object_version: int
syft_version: str
node_type: NodeType = NodeType.DOMAIN
- deployed_on: str = "Date"
organization: str = "OpenMined"
- on_board: bool = False
description: str = "Text"
- signup_enabled: Optional[bool]
- admin_email: Optional[str]
node_side_type: str
show_warnings: bool
@@ -103,6 +98,8 @@ class NodeMetadataJSON(BaseModel, StorableObjectType):
node_side_type: str
show_warnings: bool
+ # admin_email: str
+
def check_version(self, client_version: str) -> bool:
return check_version(
client_version=client_version,
diff --git a/packages/syft/src/syft/service/network/network_service.py b/packages/syft/src/syft/service/network/network_service.py
index ee8fe02843b..f652253efdc 100644
--- a/packages/syft/src/syft/service/network/network_service.py
+++ b/packages/syft/src/syft/service/network/network_service.py
@@ -17,6 +17,7 @@
from ...node.credentials import SyftVerifyKey
from ...node.worker_settings import WorkerSettings
from ...serde.serializable import serializable
+from ...service.settings.settings import NodeSettings
from ...store.document_store import BaseUIDStoreStash
from ...store.document_store import DocumentStore
from ...store.document_store import PartitionKey
@@ -536,3 +537,10 @@ def metadata_to_peer() -> List[Callable]:
return [
keep(["id", "name", "verify_key", "node_type", "admin_email"]),
]
+
+
+@transform(NodeSettings, NodePeer)
+def settings_to_peer() -> List[Callable]:
+ return [
+ keep(["id", "name", "verify_key", "node_type", "admin_email"]),
+ ]
diff --git a/packages/syft/src/syft/service/network/routes.py b/packages/syft/src/syft/service/network/routes.py
index 868110bf5fd..621cc68e7d8 100644
--- a/packages/syft/src/syft/service/network/routes.py
+++ b/packages/syft/src/syft/service/network/routes.py
@@ -64,7 +64,7 @@ def validate_with_context(self, context: AuthedServiceContext) -> NodePeer:
return SyftError(message="Signature Verification Failed in ping")
# Step 2: Create a Node Peer with the given route
- self_node_peer = context.node.metadata.to(NodePeer)
+ self_node_peer = context.node.settings.to(NodePeer)
self_node_peer.node_routes.append(self)
return self_node_peer
diff --git a/packages/syft/src/syft/service/request/request.py b/packages/syft/src/syft/service/request/request.py
index 2c9b5741fd1..df61bce6516 100644
--- a/packages/syft/src/syft/service/request/request.py
+++ b/packages/syft/src/syft/service/request/request.py
@@ -241,7 +241,7 @@ def _repr_html_(self) -> Any:
)
metadata = api.services.metadata.get_metadata()
- admin_email = metadata.admin_email
+ # admin_email = metadata.admin_email
node_name = api.node_name.capitalize() if api.node_name is not None else ""
email_str = (
@@ -266,7 +266,7 @@ def _repr_html_(self) -> Any:
Changes: {str_changes}
Status: {self.status}
Requested on: {node_name} of type \
- {metadata.node_type.value.capitalize()} owned by {admin_email}
+ {metadata.node_type.value.capitalize()}
Requested by: {self.requesting_user_name} {email_str} {institution_str}
diff --git a/packages/syft/src/syft/service/settings/settings.py b/packages/syft/src/syft/service/settings/settings.py
index 1cdda879227..ef4fe8496a2 100644
--- a/packages/syft/src/syft/service/settings/settings.py
+++ b/packages/syft/src/syft/service/settings/settings.py
@@ -1,7 +1,10 @@
# stdlib
+from typing import Optional
# relative
from ...abstract_node import NodeSideType
+from ...abstract_node import NodeType
+from ...node.credentials import SyftVerifyKey
from ...serde.serializable import serializable
from ...types.syft_object import PartialSyftObject
from ...types.syft_object import SYFT_OBJECT_VERSION_1
@@ -38,8 +41,10 @@ class NodeSettings(SyftObject):
name: str = "Node"
deployed_on: str
organization: str = "OpenMined"
+ verify_key: Optional[SyftVerifyKey]
on_board: bool = True
description: str = "Text"
+ node_type: NodeType = NodeType.DOMAIN
signup_enabled: bool
admin_email: str
node_side_type: NodeSideType = NodeSideType.HIGH_SIDE
diff --git a/packages/syft/src/syft/service/user/user_service.py b/packages/syft/src/syft/service/user/user_service.py
index 6b9c14a3944..ff5040e9c67 100644
--- a/packages/syft/src/syft/service/user/user_service.py
+++ b/packages/syft/src/syft/service/user/user_service.py
@@ -411,7 +411,7 @@ def register(
else self.get_role_for_credentials(new_user.created_by)
)
can_user_register = (
- context.node.metadata.signup_enabled
+ context.node.settings.signup_enabled
or request_user_role in DATA_OWNER_ROLE_LEVEL
)
From 1f3b0219005bacd7dcd4309990181a5326913ffa Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Mon, 9 Oct 2023 23:22:58 +1100
Subject: [PATCH 07/23] removed signup_up enabled field from node classes
metadata property
---
packages/syft/src/syft/node/node.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py
index 6d30e8f2c55..0e2a0b5fde4 100644
--- a/packages/syft/src/syft/node/node.py
+++ b/packages/syft/src/syft/node/node.py
@@ -640,13 +640,11 @@ def metadata(self) -> NodeMetadata:
name = ""
organization = ""
description = ""
- signup_enabled = False
show_warnings = self.enable_warnings
settings_data = self.settings
name = settings_data.name
organization = settings_data.organization
description = settings_data.description
- signup_enabled = settings_data.signup_enabled
show_warnings = settings_data.show_warnings
return NodeMetadata(
@@ -659,7 +657,6 @@ def metadata(self) -> NodeMetadata:
description=description,
organization=organization,
node_type=self.node_type.value,
- signup_enabled=signup_enabled,
node_side_type=self.node_side_type.value,
show_warnings=show_warnings,
)
From 74e72e937644f343a47d6d9781052fc097b4d3b2 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Mon, 9 Oct 2023 23:33:37 +1100
Subject: [PATCH 08/23] removed some commented out lines I left in code
---
packages/syft/src/syft/service/metadata/node_metadata.py | 2 --
packages/syft/src/syft/service/request/request.py | 1 -
2 files changed, 3 deletions(-)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 49f05baec33..e3e523d1fc5 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -98,8 +98,6 @@ class NodeMetadataJSON(BaseModel, StorableObjectType):
node_side_type: str
show_warnings: bool
- # admin_email: str
-
def check_version(self, client_version: str) -> bool:
return check_version(
client_version=client_version,
diff --git a/packages/syft/src/syft/service/request/request.py b/packages/syft/src/syft/service/request/request.py
index df61bce6516..4d54e1c4b0c 100644
--- a/packages/syft/src/syft/service/request/request.py
+++ b/packages/syft/src/syft/service/request/request.py
@@ -241,7 +241,6 @@ def _repr_html_(self) -> Any:
)
metadata = api.services.metadata.get_metadata()
- # admin_email = metadata.admin_email
node_name = api.node_name.capitalize() if api.node_name is not None else ""
email_str = (
From e40813895630f76f5cd3dc686d35c3c162511058 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Tue, 10 Oct 2023 22:19:31 +1100
Subject: [PATCH 09/23] added node_type and verify_key to node
create_initial_settings, enclave user login broken
---
packages/syft/src/syft/node/node.py | 7 ++++++-
packages/syft/src/syft/service/metadata/node_metadata.py | 4 ++++
packages/syft/src/syft/service/network/node_peer.py | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py
index 0e2a0b5fde4..ac3009009a0 100644
--- a/packages/syft/src/syft/node/node.py
+++ b/packages/syft/src/syft/node/node.py
@@ -632,7 +632,6 @@ def settings(self) -> NodeSettings:
settings = settings_stash.get_all(self.signing_key.verify_key)
if settings.is_ok() and len(settings.ok()) > 0:
settings_data = settings.ok()[0]
- settings_data.verify_key = self.verify_key
return settings_data
@property
@@ -646,6 +645,8 @@ def metadata(self) -> NodeMetadata:
organization = settings_data.organization
description = settings_data.description
show_warnings = settings_data.show_warnings
+ # signup_enabled = settings_data.signup_enabled
+ # admin_email = settings_data.admin_email
return NodeMetadata(
name=name,
@@ -659,6 +660,8 @@ def metadata(self) -> NodeMetadata:
node_type=self.node_type.value,
node_side_type=self.node_side_type.value,
show_warnings=show_warnings,
+ # signup_enabled=signup_enabled,
+ # admin_email=admin_email,
)
@property
@@ -850,6 +853,8 @@ def create_initial_settings(self, admin_email: str) -> Optional[NodeSettings]:
flags.CAN_REGISTER = True
new_settings = NodeSettings(
name=self.name,
+ verify_key=self.verify_key,
+ node_type=self.node_type,
deployed_on=datetime.now().date().strftime("%m/%d/%Y"),
signup_enabled=flags.CAN_REGISTER,
admin_email=admin_email,
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index e3e523d1fc5..786c63da7e8 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -74,6 +74,8 @@ class NodeMetadata(SyftObject):
description: str = "Text"
node_side_type: str
show_warnings: bool
+ # signup_enabled: bool
+ # admin_email: str
def check_version(self, client_version: str) -> bool:
return check_version(
@@ -97,6 +99,8 @@ class NodeMetadataJSON(BaseModel, StorableObjectType):
description: str = "My cool domain"
node_side_type: str
show_warnings: bool
+ # signup_enabled: bool
+ # admin_email: str
def check_version(self, client_version: str) -> bool:
return check_version(
diff --git a/packages/syft/src/syft/service/network/node_peer.py b/packages/syft/src/syft/service/network/node_peer.py
index 956f5b50160..378cab2a9b0 100644
--- a/packages/syft/src/syft/service/network/node_peer.py
+++ b/packages/syft/src/syft/service/network/node_peer.py
@@ -53,7 +53,7 @@ def update_routes(self, new_routes: List[NodeRoute]) -> None:
@staticmethod
def from_client(client: SyftClient) -> Self:
if not client.metadata:
- raise Exception("Client has have metadata first")
+ raise Exception("Client has to have metadata first")
peer = client.metadata.to(NodeMetadata).to(NodePeer)
route = connection_to_route(client.connection)
From db1b54cbcd57ae94565ba10b0ff7e8fed40707f3 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Wed, 11 Oct 2023 08:41:37 +1100
Subject: [PATCH 10/23] removed some commented lines
---
packages/syft/src/syft/node/node.py | 4 ----
packages/syft/src/syft/service/metadata/node_metadata.py | 4 ----
2 files changed, 8 deletions(-)
diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py
index ac3009009a0..50ddb9da17b 100644
--- a/packages/syft/src/syft/node/node.py
+++ b/packages/syft/src/syft/node/node.py
@@ -645,8 +645,6 @@ def metadata(self) -> NodeMetadata:
organization = settings_data.organization
description = settings_data.description
show_warnings = settings_data.show_warnings
- # signup_enabled = settings_data.signup_enabled
- # admin_email = settings_data.admin_email
return NodeMetadata(
name=name,
@@ -660,8 +658,6 @@ def metadata(self) -> NodeMetadata:
node_type=self.node_type.value,
node_side_type=self.node_side_type.value,
show_warnings=show_warnings,
- # signup_enabled=signup_enabled,
- # admin_email=admin_email,
)
@property
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 786c63da7e8..e3e523d1fc5 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -74,8 +74,6 @@ class NodeMetadata(SyftObject):
description: str = "Text"
node_side_type: str
show_warnings: bool
- # signup_enabled: bool
- # admin_email: str
def check_version(self, client_version: str) -> bool:
return check_version(
@@ -99,8 +97,6 @@ class NodeMetadataJSON(BaseModel, StorableObjectType):
description: str = "My cool domain"
node_side_type: str
show_warnings: bool
- # signup_enabled: bool
- # admin_email: str
def check_version(self, client_version: str) -> bool:
return check_version(
From 61eacdaf3355cfdd11da2114046d46b4fc8f7332 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Wed, 11 Oct 2023 22:37:11 +1100
Subject: [PATCH 11/23] fixed issue with id being missing field in NodeSettings
so could correctly transform to NodePeer
---
packages/syft/src/syft/node/node.py | 1 +
packages/syft/src/syft/service/settings/settings.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py
index 50ddb9da17b..30992fee2c1 100644
--- a/packages/syft/src/syft/node/node.py
+++ b/packages/syft/src/syft/node/node.py
@@ -848,6 +848,7 @@ def create_initial_settings(self, admin_email: str) -> Optional[NodeSettings]:
if self.node_type == NodeType.ENCLAVE:
flags.CAN_REGISTER = True
new_settings = NodeSettings(
+ id=self.id,
name=self.name,
verify_key=self.verify_key,
node_type=self.node_type,
diff --git a/packages/syft/src/syft/service/settings/settings.py b/packages/syft/src/syft/service/settings/settings.py
index ef4fe8496a2..da97806aca3 100644
--- a/packages/syft/src/syft/service/settings/settings.py
+++ b/packages/syft/src/syft/service/settings/settings.py
@@ -38,10 +38,11 @@ class NodeSettings(SyftObject):
"admin_email",
]
+ id: UID
name: str = "Node"
deployed_on: str
organization: str = "OpenMined"
- verify_key: Optional[SyftVerifyKey]
+ verify_key: SyftVerifyKey
on_board: bool = True
description: str = "Text"
node_type: NodeType = NodeType.DOMAIN
From 62b18e9bec4fd38170cf1906e270e3fc678f4dcb Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Wed, 11 Oct 2023 22:45:10 +1100
Subject: [PATCH 12/23] fixed liniting
---
packages/syft/src/syft/service/settings/settings.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/packages/syft/src/syft/service/settings/settings.py b/packages/syft/src/syft/service/settings/settings.py
index da97806aca3..c12c9b21c52 100644
--- a/packages/syft/src/syft/service/settings/settings.py
+++ b/packages/syft/src/syft/service/settings/settings.py
@@ -1,5 +1,4 @@
# stdlib
-from typing import Optional
# relative
from ...abstract_node import NodeSideType
From 83080e9d829a9a4e6fab5c80918a7e28decca5f4 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 12 Oct 2023 02:45:13 +1100
Subject: [PATCH 13/23] fixed some tests that were failing
---
packages/syft/tests/syft/settings/fixtures.py | 9 ++++--
.../tests/syft/users/user_service_test.py | 30 +++++++++----------
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/packages/syft/tests/syft/settings/fixtures.py b/packages/syft/tests/syft/settings/fixtures.py
index 1a4c6ac0faf..0bfce5d41f9 100644
--- a/packages/syft/tests/syft/settings/fixtures.py
+++ b/packages/syft/tests/syft/settings/fixtures.py
@@ -7,6 +7,9 @@
# syft absolute
from syft.__init__ import __version__
from syft.abstract_node import NodeSideType
+from syft.abstract_node import NodeType
+from syft.node.credentials import SyftSigningKey
+from syft.node.credentials import SyftVerifyKey
from syft.service.metadata.node_metadata import NodeMetadataJSON
from syft.service.settings.settings import NodeSettings
from syft.service.settings.settings import NodeSettingsUpdate
@@ -14,6 +17,7 @@
from syft.service.settings.settings_stash import SettingsStash
from syft.types.syft_object import HIGHEST_SYFT_OBJECT_VERSION
from syft.types.syft_object import LOWEST_SYFT_OBJECT_VERSION
+from syft.types.uid import UID
@pytest.fixture
@@ -24,6 +28,7 @@ def settings_stash(document_store) -> SettingsStash:
@pytest.fixture
def settings(worker, faker) -> NodeSettings:
return NodeSettings(
+ id=UID(),
name=worker.name,
organization=faker.text(),
on_board=faker.boolean(),
@@ -33,6 +38,8 @@ def settings(worker, faker) -> NodeSettings:
admin_email="info@openmined.org",
node_side_type=NodeSideType.LOW_SIDE,
show_warnings=False,
+ verify_key=SyftSigningKey.generate().verify_key,
+ node_type=NodeType.DOMAIN,
)
@@ -55,8 +62,6 @@ def metadata_json(faker) -> NodeMetadataJSON:
highest_object_version=HIGHEST_SYFT_OBJECT_VERSION,
lowest_object_version=LOWEST_SYFT_OBJECT_VERSION,
syft_version=__version__,
- signup_enabled=False,
- admin_email="info@openmined.org",
node_side_type=NodeSideType.LOW_SIDE.value,
show_warnings=False,
)
diff --git a/packages/syft/tests/syft/users/user_service_test.py b/packages/syft/tests/syft/users/user_service_test.py
index c17d6517ee7..94e3d7a5deb 100644
--- a/packages/syft/tests/syft/users/user_service_test.py
+++ b/packages/syft/tests/syft/users/user_service_test.py
@@ -29,11 +29,11 @@
from syft.types.uid import UID
-def metadata_with_signup_enabled(worker) -> Type:
- mock_metadata = worker.metadata
- mock_metadata.signup_enabled = True
+def settings_with_signup_enabled(worker) -> Type:
+ mock_settings = worker.settings
+ mock_settings.signup_enabled = True
- return mock_metadata
+ return mock_settings
def test_userservice_create_when_user_exists(
@@ -476,11 +476,11 @@ def mock_get_by_email(credentials: SyftVerifyKey, email):
monkeypatch.setattr(user_service.stash, "get_by_email", mock_get_by_email)
expected_error_msg = f"User already exists with email: {guest_create_user.email}"
- # Patch Worker Metadata to enable signup
+ # Patch Worker settings to enable signup
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=metadata_with_signup_enabled(worker),
+ return_value=settings_with_signup_enabled(worker),
):
mock_worker = Worker.named(name="mock-node")
node_context = NodeServiceContext(node=mock_worker)
@@ -503,11 +503,11 @@ def mock_get_by_email(credentials: SyftVerifyKey, email):
monkeypatch.setattr(user_service.stash, "get_by_email", mock_get_by_email)
- # Patch Worker Metadata to enable signup
+ # Patch Worker settings to enable signup
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=metadata_with_signup_enabled(worker),
+ return_value=settings_with_signup_enabled(worker),
):
mock_worker = Worker.named(name="mock-node")
node_context = NodeServiceContext(node=mock_worker)
@@ -530,12 +530,12 @@ def mock_get_by_email(credentials: SyftVerifyKey, email: str) -> Ok:
def mock_set(*args, **kwargs) -> Ok:
return Ok(guest_user)
- # Patch Worker Metadata to enable signup
+ # Patch Worker settings to enable signup
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=metadata_with_signup_enabled(worker),
+ return_value=settings_with_signup_enabled(worker),
):
mock_worker = Worker.named(name="mock-node")
node_context = NodeServiceContext(node=mock_worker)
@@ -577,9 +577,9 @@ def mock_set(
return Err(expected_error_msg)
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=metadata_with_signup_enabled(worker),
+ return_value=settings_with_signup_enabled(worker),
):
mock_worker = Worker.named(name="mock-node")
node_context = NodeServiceContext(node=mock_worker)
From ddbd3e0ce251366b8078a9835636759b2990969b Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 12 Oct 2023 02:58:00 +1100
Subject: [PATCH 14/23] fixed linting
---
packages/syft/tests/syft/settings/fixtures.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/packages/syft/tests/syft/settings/fixtures.py b/packages/syft/tests/syft/settings/fixtures.py
index 0bfce5d41f9..03b24646ab8 100644
--- a/packages/syft/tests/syft/settings/fixtures.py
+++ b/packages/syft/tests/syft/settings/fixtures.py
@@ -9,7 +9,6 @@
from syft.abstract_node import NodeSideType
from syft.abstract_node import NodeType
from syft.node.credentials import SyftSigningKey
-from syft.node.credentials import SyftVerifyKey
from syft.service.metadata.node_metadata import NodeMetadataJSON
from syft.service.settings.settings import NodeSettings
from syft.service.settings.settings import NodeSettingsUpdate
From 4e69127dd90724ae8a92927de44ab76c4197281b Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Thu, 12 Oct 2023 03:35:34 +1100
Subject: [PATCH 15/23] fixed more broken tests
---
.../syft/settings/settings_service_test.py | 22 ++++++++++---------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/packages/syft/tests/syft/settings/settings_service_test.py b/packages/syft/tests/syft/settings/settings_service_test.py
index 967c00ececa..8169e4172ac 100644
--- a/packages/syft/tests/syft/settings/settings_service_test.py
+++ b/packages/syft/tests/syft/settings/settings_service_test.py
@@ -1,5 +1,6 @@
# stdlib
from copy import deepcopy
+from datetime import datetime
from unittest import mock
# third party
@@ -14,7 +15,6 @@
from syft.node.credentials import SyftSigningKey
from syft.node.credentials import SyftVerifyKey
from syft.service.context import AuthedServiceContext
-from syft.service.metadata.node_metadata import NodeMetadata
from syft.service.response import SyftError
from syft.service.response import SyftSuccess
from syft.service.settings.settings import NodeSettings
@@ -227,7 +227,7 @@ def test_settings_allow_guest_registration(
# Create a new worker
verify_key = SyftSigningKey.generate().verify_key
- mock_node_metadata = NodeMetadata(
+ mock_node_settings = NodeSettings(
name=faker.name(),
verify_key=verify_key,
highest_object_version=1,
@@ -237,12 +237,13 @@ def test_settings_allow_guest_registration(
admin_email="info@openmined.org",
node_side_type=NodeSideType.LOW_SIDE,
show_warnings=False,
+ deployed_on=datetime.now().date().strftime("%m/%d/%Y"),
)
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=mock_node_metadata,
+ return_value=mock_node_settings,
):
worker = syft.Worker.named(name=faker.name(), reset=True)
guest_domain_client = worker.guest_client
@@ -268,11 +269,11 @@ def test_settings_allow_guest_registration(
assert any(user.email == email1 for user in root_domain_client.users)
# only after the root client enable other users to signup, they can
- mock_node_metadata.signup_enabled = True
+ mock_node_settings.signup_enabled = True
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=mock_node_metadata,
+ return_value=mock_node_settings,
):
worker = syft.Worker.named(name=faker.name(), reset=True)
guest_domain_client = worker.guest_client
@@ -309,7 +310,7 @@ def get_mock_client(faker, root_client, role):
return guest_client
verify_key = SyftSigningKey.generate().verify_key
- mock_node_metadata = NodeMetadata(
+ mock_node_settings = NodeSettings(
name=faker.name(),
verify_key=verify_key,
highest_object_version=1,
@@ -319,12 +320,13 @@ def get_mock_client(faker, root_client, role):
admin_email="info@openmined.org",
node_side_type=NodeSideType.LOW_SIDE,
show_warnings=False,
+ deployed_on=datetime.now().date().strftime("%m/%d/%Y"),
)
with mock.patch(
- "syft.Worker.metadata",
+ "syft.Worker.settings",
new_callable=mock.PropertyMock,
- return_value=mock_node_metadata,
+ return_value=mock_node_settings,
):
worker = syft.Worker.named(name=faker.name(), reset=True)
root_client = worker.root_client
From 7701b58b25cc24f1fa5a3dff9c378aeb7dc64add Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Fri, 13 Oct 2023 19:02:32 +1100
Subject: [PATCH 16/23] fixed data-engineer notebook
---
.../data-engineer/02-deployment-types.ipynb | 26 ++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/notebooks/tutorials/data-engineer/02-deployment-types.ipynb b/notebooks/tutorials/data-engineer/02-deployment-types.ipynb
index 9369b01e63b..e5858f8e207 100644
--- a/notebooks/tutorials/data-engineer/02-deployment-types.ipynb
+++ b/notebooks/tutorials/data-engineer/02-deployment-types.ipynb
@@ -73,6 +73,16 @@
")"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "86e66c8b-afa4-4236-a362-7ec9e07a7063",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "assert memory_node is not None"
+ ]
+ },
{
"cell_type": "markdown",
"id": "4573b485",
@@ -89,13 +99,23 @@
"outputs": [],
"source": [
"webserver_node = sy.Orchestra.launch(\n",
- " name=\"Arbitrary Dev Node\",\n",
+ " name=\"Arbitrary Webserver Dev Node\",\n",
" dev_mode=True,\n",
" reset=True,\n",
- " port=80\n",
+ " port=8081\n",
")"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "86ce3464-a51c-4870-a293-e479c08c66bc",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "assert webserver_node is not None"
+ ]
+ },
{
"cell_type": "markdown",
"id": "dd74621a",
@@ -355,7 +375,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.9"
+ "version": "3.10.12"
}
},
"nbformat": 4,
From 8142208c06e665ca4e189fc3c86ed3b7786f68d1 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Tue, 17 Oct 2023 19:09:22 +1100
Subject: [PATCH 17/23] upgarded nodemetadata, nodemetadataupgrade and
nodesettings versions in preperation for merging post versioning PR
---
packages/syft/src/syft/service/metadata/node_metadata.py | 7 ++++---
packages/syft/src/syft/service/settings/settings.py | 3 ++-
packages/syft/src/syft/types/syft_object.py | 3 ++-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index e3e523d1fc5..2effa7f7a4e 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -14,7 +14,8 @@
from ...abstract_node import NodeType
from ...node.credentials import SyftVerifyKey
from ...serde.serializable import serializable
-from ...types.syft_object import SYFT_OBJECT_VERSION_1
+from ...types.syft_object import SYFT_OBJECT_VERSION_2
+from ...types.syft_object import SYFT_OBJECT_VERSION_3
from ...types.syft_object import StorableObjectType
from ...types.syft_object import SyftObject
from ...types.transforms import convert_types
@@ -45,7 +46,7 @@ def check_version(
@serializable()
class NodeMetadataUpdate(SyftObject):
__canonical_name__ = "NodeMetadataUpdate"
- __version__ = SYFT_OBJECT_VERSION_1
+ __version__ = SYFT_OBJECT_VERSION_2
name: Optional[str]
organization: Optional[str]
@@ -61,7 +62,7 @@ class NodeMetadataUpdate(SyftObject):
@serializable()
class NodeMetadata(SyftObject):
__canonical_name__ = "NodeMetadata"
- __version__ = SYFT_OBJECT_VERSION_1
+ __version__ = SYFT_OBJECT_VERSION_3
name: str
id: UID
diff --git a/packages/syft/src/syft/service/settings/settings.py b/packages/syft/src/syft/service/settings/settings.py
index c12c9b21c52..f27aad04e4c 100644
--- a/packages/syft/src/syft/service/settings/settings.py
+++ b/packages/syft/src/syft/service/settings/settings.py
@@ -7,6 +7,7 @@
from ...serde.serializable import serializable
from ...types.syft_object import PartialSyftObject
from ...types.syft_object import SYFT_OBJECT_VERSION_1
+from ...types.syft_object import SYFT_OBJECT_VERSION_2
from ...types.syft_object import SyftObject
from ...types.uid import UID
@@ -28,7 +29,7 @@ class NodeSettingsUpdate(PartialSyftObject):
@serializable()
class NodeSettings(SyftObject):
__canonical_name__ = "NodeSettings"
- __version__ = SYFT_OBJECT_VERSION_1
+ __version__ = SYFT_OBJECT_VERSION_2
__repr_attrs__ = [
"name",
"organization",
diff --git a/packages/syft/src/syft/types/syft_object.py b/packages/syft/src/syft/types/syft_object.py
index 9aa056bc87f..c8eb2bd021e 100644
--- a/packages/syft/src/syft/types/syft_object.py
+++ b/packages/syft/src/syft/types/syft_object.py
@@ -50,8 +50,9 @@
SYFT_OBJECT_VERSION_1 = 1
SYFT_OBJECT_VERSION_2 = 2
+SYFT_OBJECT_VERSION_3 = 3
-supported_object_versions = [SYFT_OBJECT_VERSION_1, SYFT_OBJECT_VERSION_2]
+supported_object_versions = [SYFT_OBJECT_VERSION_1, SYFT_OBJECT_VERSION_2, SYFT_OBJECT_VERSION_3]
HIGHEST_SYFT_OBJECT_VERSION = max(supported_object_versions)
LOWEST_SYFT_OBJECT_VERSION = min(supported_object_versions)
From 958dfebd5362a44b787c568445ea635d14e71b54 Mon Sep 17 00:00:00 2001
From: Peter Chung
Date: Tue, 17 Oct 2023 19:19:42 +1100
Subject: [PATCH 18/23] copied older versions of upgraded classes into code,
migrations are not defined yet
---
.../syft/service/metadata/node_metadata.py | 75 +++++++++++++++++++
.../src/syft/service/settings/settings.py | 23 ++++++
2 files changed, 98 insertions(+)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 2effa7f7a4e..ca625f24ee1 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -14,6 +14,7 @@
from ...abstract_node import NodeType
from ...node.credentials import SyftVerifyKey
from ...serde.serializable import serializable
+from ...types.syft_object import SYFT_OBJECT_VERSION_1
from ...types.syft_object import SYFT_OBJECT_VERSION_2
from ...types.syft_object import SYFT_OBJECT_VERSION_3
from ...types.syft_object import StorableObjectType
@@ -43,6 +44,23 @@ def check_version(
return True
+@serializable()
+class NodeMetadataUpdateV1(SyftObject):
+ __canonical_name__ = "NodeMetadataUpdate"
+ __version__ = SYFT_OBJECT_VERSION_1
+
+ name: Optional[str]
+ organization: Optional[str]
+ description: Optional[str]
+ on_board: Optional[bool]
+ id: Optional[UID]
+ verify_key: Optional[SyftVerifyKey]
+ highest_object_version: Optional[int]
+ lowest_object_version: Optional[int]
+ syft_version: Optional[str]
+ admin_email: Optional[str]
+
+
@serializable()
class NodeMetadataUpdate(SyftObject):
__canonical_name__ = "NodeMetadataUpdate"
@@ -59,6 +77,63 @@ class NodeMetadataUpdate(SyftObject):
syft_version: Optional[str]
+@serializable()
+class NodeMetadataV1(SyftObject):
+ __canonical_name__ = "NodeMetadata"
+ __version__ = SYFT_OBJECT_VERSION_1
+
+ name: str
+ id: UID
+ verify_key: SyftVerifyKey
+ highest_object_version: int
+ lowest_object_version: int
+ syft_version: str
+ node_type: NodeType = NodeType.DOMAIN
+ deployed_on: str = "Date"
+ organization: str = "OpenMined"
+ on_board: bool = False
+ description: str = "Text"
+ signup_enabled: bool
+ admin_email: str
+ node_side_type: str
+ show_warnings: bool
+
+ def check_version(self, client_version: str) -> bool:
+ return check_version(
+ client_version=client_version,
+ server_version=self.syft_version,
+ server_name=self.name,
+ )
+
+
+@serializable()
+class NodeMetadataV2(SyftObject):
+ __canonical_name__ = "NodeMetadata"
+ __version__ = SYFT_OBJECT_VERSION_2
+
+ name: str
+ highest_version: int
+ lowest_version: int
+ id: UID
+ verify_key: SyftVerifyKey
+ syft_version: str
+ node_type: NodeType = NodeType.DOMAIN
+ deployed_on: str = "Date"
+ organization: str = "OpenMined"
+ on_board: bool = False
+ description: str = "Text"
+ signup_enabled: bool
+ admin_email: str
+ node_side_type: str
+ show_warnings: bool
+
+ def check_version(self, client_version: str) -> bool:
+ return check_version(
+ client_version=client_version,
+ server_version=self.syft_version,
+ server_name=self.name,
+ )
+
@serializable()
class NodeMetadata(SyftObject):
__canonical_name__ = "NodeMetadata"
diff --git a/packages/syft/src/syft/service/settings/settings.py b/packages/syft/src/syft/service/settings/settings.py
index f27aad04e4c..a2efdf29e71 100644
--- a/packages/syft/src/syft/service/settings/settings.py
+++ b/packages/syft/src/syft/service/settings/settings.py
@@ -26,6 +26,29 @@ class NodeSettingsUpdate(PartialSyftObject):
admin_email: str
+@serializable()
+class NodeSettingsV1(SyftObject):
+ __canonical_name__ = "NodeSettings"
+ __version__ = SYFT_OBJECT_VERSION_1
+ __repr_attrs__ = [
+ "name",
+ "organization",
+ "deployed_on",
+ "signup_enabled",
+ "admin_email",
+ ]
+
+ name: str = "Node"
+ deployed_on: str
+ organization: str = "OpenMined"
+ on_board: bool = True
+ description: str = "Text"
+ signup_enabled: bool
+ admin_email: str
+ node_side_type: NodeSideType = NodeSideType.HIGH_SIDE
+ show_warnings: bool
+
+
@serializable()
class NodeSettings(SyftObject):
__canonical_name__ = "NodeSettings"
From 74bf9b4106ebd211dac7de2112c512000b1af174 Mon Sep 17 00:00:00 2001
From: Shubham Gupta
Date: Tue, 17 Oct 2023 17:51:08 +0530
Subject: [PATCH 19/23] define upgrade/downgrade migrations for node metadata
version 3
---
.../src/syft/service/metadata/migrations.py | 38 ++++++++++++++++++-
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/packages/syft/src/syft/service/metadata/migrations.py b/packages/syft/src/syft/service/metadata/migrations.py
index dd6200b97a2..2097db8cb45 100644
--- a/packages/syft/src/syft/service/metadata/migrations.py
+++ b/packages/syft/src/syft/service/metadata/migrations.py
@@ -1,11 +1,17 @@
+# stdlib
+from typing import Callable
+
# relative
from ...types.syft_migration import migrate
+from ...types.transforms import TransformContext
+from ...types.transforms import drop
from ...types.transforms import rename
from .node_metadata import NodeMetadata
from .node_metadata import NodeMetadataV1
+from .node_metadata import NodeMetadataV2
-@migrate(NodeMetadataV1, NodeMetadata)
+@migrate(NodeMetadataV1, NodeMetadataV2)
def upgrade_metadata_v1_to_v2():
return [
rename("highest_object_version", "highest_version"),
@@ -13,9 +19,37 @@ def upgrade_metadata_v1_to_v2():
]
-@migrate(NodeMetadata, NodeMetadataV1)
+@migrate(NodeMetadataV2, NodeMetadataV1)
def downgrade_metadata_v2_to_v1():
return [
rename("highest_version", "highest_object_version"),
rename("lowest_version", "lowest_object_version"),
]
+
+
+@migrate(NodeMetadataV2, NodeMetadata)
+def upgrade_metadata_v2_to_v3():
+ return [drop(["deployed_on", "on_board", "signup_enabled", "admin_email"])]
+
+
+def _downgrade_metadata_v3_to_v2() -> Callable:
+ def set_defaults_from_settings(context: TransformContext) -> TransformContext:
+ # Extract from settings if node is attached to context
+ if context.node is not None:
+ context.output["deployed_on"] = context.node.settings.deployed_on
+ context.output["on_board"] = context.node.settings.on_board
+ context.output["signup_enabled"] = context.node.settings.signup_enabled
+ context.output["admin_email"] = context.node.settings.admin_email
+ else:
+ # Else set default value
+ context.output["signup_enabled"] = False
+ context.output["admin_email"] = ""
+
+ return context
+
+ return set_defaults_from_settings
+
+
+@migrate(NodeMetadata, NodeMetadataV2)
+def downgrade_metadata_v3_to_v2():
+ return [_downgrade_metadata_v3_to_v2()]
From cd34276e7b87c035f4e1f49a5a588955927405cd Mon Sep 17 00:00:00 2001
From: Shubham Gupta
Date: Tue, 17 Oct 2023 18:07:12 +0530
Subject: [PATCH 20/23] add migrations for NodeSetting
---
.../src/syft/service/settings/__init__.py | 2 ++
.../src/syft/service/settings/migrations.py | 32 +++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 packages/syft/src/syft/service/settings/__init__.py
create mode 100644 packages/syft/src/syft/service/settings/migrations.py
diff --git a/packages/syft/src/syft/service/settings/__init__.py b/packages/syft/src/syft/service/settings/__init__.py
new file mode 100644
index 00000000000..80eb6c422b0
--- /dev/null
+++ b/packages/syft/src/syft/service/settings/__init__.py
@@ -0,0 +1,2 @@
+# relative
+from .migrations import * # noqa: F403
diff --git a/packages/syft/src/syft/service/settings/migrations.py b/packages/syft/src/syft/service/settings/migrations.py
new file mode 100644
index 00000000000..a97f73d78bf
--- /dev/null
+++ b/packages/syft/src/syft/service/settings/migrations.py
@@ -0,0 +1,32 @@
+# stdlib
+from typing import Callable
+
+# relative
+from ...types.syft_migration import migrate
+from ...types.transforms import TransformContext
+from ...types.transforms import drop
+from .settings import NodeSettings
+from .settings import NodeSettingsV1
+
+
+def set_from_node_to_key(node_attr: str, key: str) -> Callable:
+ def extract_from_node(context: TransformContext) -> TransformContext:
+ context.output[key] = getattr(context.node, node_attr)
+ return context
+
+ return extract_from_node
+
+
+@migrate(NodeSettingsV1, NodeSettings)
+def upgrade_metadata_v1_to_v2():
+ return [
+ set_from_node_to_key("verify_key", "verify_key"),
+ set_from_node_to_key("node_type", "node_type"),
+ ]
+
+
+@migrate(NodeSettings, NodeSettingsV1)
+def downgrade_metadata_v2_to_v1():
+ return [
+ drop(["verify_key", "node_type"]),
+ ]
From 0f95c0d1ef715c16da8502276551abecdade1c35 Mon Sep 17 00:00:00 2001
From: Shubham Gupta
Date: Thu, 19 Oct 2023 18:11:54 +0530
Subject: [PATCH 21/23] rename NodeMetadata to NodeMetadataV3 and
NodeMetadataV1 to NodeMetadata - rename NodeSettings to NodeSettingsV2 and
NodeSettingsV1 to NodeSettings - rename NodeMetadataUpdate to
NodeMetadataUpdateV2 and NodeMetadataUpdateV1 to NodeMetadataUpdate - reset
protocol version
---
packages/syft/src/syft/client/client.py | 4 +-
packages/syft/src/syft/node/node.py | 14 +-
.../src/syft/protocol/protocol_version.json | 782 +-----------------
.../src/syft/service/metadata/migrations.py | 10 +-
.../syft/service/metadata/node_metadata.py | 12 +-
.../syft/service/network/network_service.py | 8 +-
.../src/syft/service/network/node_peer.py | 4 +-
.../syft/src/syft/service/project/project.py | 6 +-
.../src/syft/service/settings/migrations.py | 6 +-
.../src/syft/service/settings/settings.py | 4 +-
.../syft/service/settings/settings_service.py | 4 +-
.../syft/service/settings/settings_stash.py | 14 +-
packages/syft/tests/syft/settings/fixtures.py | 6 +-
.../syft/settings/settings_service_test.py | 26 +-
.../syft/settings/settings_stash_test.py | 14 +-
15 files changed, 67 insertions(+), 847 deletions(-)
diff --git a/packages/syft/src/syft/client/client.py b/packages/syft/src/syft/client/client.py
index c6371f487a0..3bec8aefd7e 100644
--- a/packages/syft/src/syft/client/client.py
+++ b/packages/syft/src/syft/client/client.py
@@ -41,8 +41,8 @@
from ..serde.serializable import serializable
from ..serde.serialize import _serialize
from ..service.context import NodeServiceContext
-from ..service.metadata.node_metadata import NodeMetadata
from ..service.metadata.node_metadata import NodeMetadataJSON
+from ..service.metadata.node_metadata import NodeMetadataV3
from ..service.response import SyftError
from ..service.response import SyftSuccess
from ..service.user.user import UserCreate
@@ -597,7 +597,7 @@ def exchange_route(self, client: Self) -> Union[SyftSuccess, SyftError]:
result = self.api.services.network.exchange_credentials_with(
self_node_route=self_node_route,
remote_node_route=remote_node_route,
- remote_node_verify_key=client.metadata.to(NodeMetadata).verify_key,
+ remote_node_verify_key=client.metadata.to(NodeMetadataV3).verify_key,
)
return result
diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py
index 6d5fd782ddc..fa797b92253 100644
--- a/packages/syft/src/syft/node/node.py
+++ b/packages/syft/src/syft/node/node.py
@@ -64,7 +64,7 @@
from ..service.dataset.dataset_service import DatasetService
from ..service.enclave.enclave_service import EnclaveService
from ..service.metadata.metadata_service import MetadataService
-from ..service.metadata.node_metadata import NodeMetadata
+from ..service.metadata.node_metadata import NodeMetadataV3
from ..service.network.network_service import NetworkService
from ..service.notification.notification_service import NotificationService
from ..service.object_search.migration_state_service import MigrateStateService
@@ -81,7 +81,7 @@
from ..service.service import AbstractService
from ..service.service import ServiceConfigRegistry
from ..service.service import UserServiceConfigRegistry
-from ..service.settings.settings import NodeSettings
+from ..service.settings.settings import NodeSettingsV2
from ..service.settings.settings_service import SettingsService
from ..service.settings.settings_stash import SettingsStash
from ..service.user.user import User
@@ -679,7 +679,7 @@ def _get_service_method_from_path(self, path: str) -> Callable:
return getattr(service_obj, method_name)
@property
- def settings(self) -> NodeSettings:
+ def settings(self) -> NodeSettingsV2:
settings_stash = SettingsStash(store=self.document_store)
settings = settings_stash.get_all(self.signing_key.verify_key)
if settings.is_ok() and len(settings.ok()) > 0:
@@ -687,7 +687,7 @@ def settings(self) -> NodeSettings:
return settings_data
@property
- def metadata(self) -> NodeMetadata:
+ def metadata(self) -> NodeMetadataV3:
name = ""
organization = ""
description = ""
@@ -698,7 +698,7 @@ def metadata(self) -> NodeMetadata:
description = settings_data.description
show_warnings = settings_data.show_warnings
- return NodeMetadata(
+ return NodeMetadataV3(
name=name,
id=self.id,
verify_key=self.verify_key,
@@ -895,7 +895,7 @@ def get_unauthed_context(
) -> NodeServiceContext:
return UnauthedServiceContext(node=self, login_credentials=login_credentials)
- def create_initial_settings(self, admin_email: str) -> Optional[NodeSettings]:
+ def create_initial_settings(self, admin_email: str) -> Optional[NodeSettingsV2]:
if self.name is None:
self.name = random_name()
try:
@@ -909,7 +909,7 @@ def create_initial_settings(self, admin_email: str) -> Optional[NodeSettings]:
# as enclaves do not have superusers
if self.node_type == NodeType.ENCLAVE:
flags.CAN_REGISTER = True
- new_settings = NodeSettings(
+ new_settings = NodeSettingsV2(
id=self.id,
name=self.name,
verify_key=self.verify_key,
diff --git a/packages/syft/src/syft/protocol/protocol_version.json b/packages/syft/src/syft/protocol/protocol_version.json
index 396b2be360e..0967ef424bc 100644
--- a/packages/syft/src/syft/protocol/protocol_version.json
+++ b/packages/syft/src/syft/protocol/protocol_version.json
@@ -1,781 +1 @@
-{
- "dev": {
- "object_versions": {
- "PartialSyftObject": {
- "1": {
- "version": 1,
- "hash": "008917584d8e1c09015cdbef02f59c0622f48e0618877c1b44425c8846befc13",
- "action": "add"
- }
- },
- "NodeMetadataUpdate": {
- "1": {
- "version": 1,
- "hash": "569d124c23590360bda240c19b53314ccc6204c5d1ab0d2898976a028e002191",
- "action": "add"
- }
- },
- "NodeMetadata": {
- "1": {
- "version": 1,
- "hash": "6bee018894dfdf697ea624740d0bf051750e0b0d8470ced59646f6d8812068ac",
- "action": "add"
- },
- "2": {
- "version": 2,
- "hash": "f856169fea72486cd436875ce4411ef935da11eb7c5af48121adfa00d4c0cdb6",
- "action": "add"
- }
- },
- "LinkedObject": {
- "1": {
- "version": 1,
- "hash": "824567c6933c095d0e2f6995c8de3581c0fbd2e9e4ead35c8159f7964709c28e",
- "action": "add"
- }
- },
- "BaseConfig": {
- "1": {
- "version": 1,
- "hash": "4e5257080ce615aa4122b02bad8487e4c7d6d0f171ff77abbc9e8cd3e33df89a",
- "action": "add"
- }
- },
- "ServiceConfig": {
- "1": {
- "version": 1,
- "hash": "ca91f59bf045d949d82860f7d52655bfbede4cf6bdc5bae8f847f08a16f05d74",
- "action": "add"
- }
- },
- "LibConfig": {
- "1": {
- "version": 1,
- "hash": "c6ff229aea16874c5d9ae4d1f9e500d13f5cf984bbcee7abd16c5841707a2f78",
- "action": "add"
- }
- },
- "APIEndpoint": {
- "1": {
- "version": 1,
- "hash": "c0e83867b107113e6fed06364ba364c24b2f4af35b15a3869b176318d3be7989",
- "action": "add"
- }
- },
- "LibEndpoint": {
- "1": {
- "version": 1,
- "hash": "153eac6d8990774eebfffaa75a9895e7c4e1a0e09465d5da0baf4c3a3b03369d",
- "action": "add"
- }
- },
- "SignedSyftAPICall": {
- "1": {
- "version": 1,
- "hash": "e66a116de2fa44ebdd0d4c2d7d5a047dedb555fd201a0f431cd8017d9d33a61d",
- "action": "add"
- }
- },
- "SyftAPICall": {
- "1": {
- "version": 1,
- "hash": "014bd1d0933f6070888a313edba239170759de24eae49bf2374c1be4dbe2b4d7",
- "action": "add"
- }
- },
- "SyftAPIData": {
- "1": {
- "version": 1,
- "hash": "db101a75227e34750d7056785a1e87bb2e8ad6604f19c372d0cb6aa437243bf5",
- "action": "add"
- }
- },
- "SyftAPI": {
- "1": {
- "version": 1,
- "hash": "2bba1d9fcf677a58e35bf903de3da22ee4913af138aa3012af9c46b3609579cd",
- "action": "add"
- }
- },
- "User": {
- "1": {
- "version": 1,
- "hash": "078636e64f737e60245b39cf348d30fb006531e80c12b70aa7cf98254e1bb37a",
- "action": "add"
- }
- },
- "UserUpdate": {
- "1": {
- "version": 1,
- "hash": "839dd90aeb611e1dc471c8fd6daf230e913465c0625c6a297079cb7f0a271195",
- "action": "add"
- }
- },
- "UserCreate": {
- "1": {
- "version": 1,
- "hash": "dab78b63544ae91c09f9843c323cb237c0a6fcfeb71c1acf5f738e2fcf5c277f",
- "action": "add"
- }
- },
- "UserSearch": {
- "1": {
- "version": 1,
- "hash": "69d1e10b81c8a4143cf70e4f911d8562732af2458ebbc455ca64542f11373dd1",
- "action": "add"
- }
- },
- "UserView": {
- "1": {
- "version": 1,
- "hash": "63289383fe7e7584652f242a4362ce6e2f0ade52f6416ab6149b326a506b0675",
- "action": "add"
- }
- },
- "UserViewPage": {
- "1": {
- "version": 1,
- "hash": "16dac6209b19a934d286ef1efa874379e0040c324e71023c57d1bc6d2d367171",
- "action": "add"
- }
- },
- "UserPrivateKey": {
- "1": {
- "version": 1,
- "hash": "7cb196587887f0f3bffb298dd9f3b88509e9b2748792bf8dc03bdd0d6b98714a",
- "action": "add"
- }
- },
- "StoreConfig": {
- "1": {
- "version": 1,
- "hash": "17de8875cf590311ddb042140347ffc79d4a85028e504dad178ca4e1237ec861",
- "action": "add"
- }
- },
- "NodeSettingsUpdate": {
- "1": {
- "version": 1,
- "hash": "b6ddc66ff270a3c2c4760e31e1a55d72ed04ccae2d0115ebe2fba6f2bf9bd119",
- "action": "add"
- }
- },
- "NodeSettings": {
- "1": {
- "version": 1,
- "hash": "b662047bb278f4f5db77c102f94b733c3a929839271b3d6b82ea174a60e2aaf0",
- "action": "add"
- }
- },
- "HTTPConnection": {
- "1": {
- "version": 1,
- "hash": "5ee19eaf55ecbe7945ea45924c036ec0f500114a2f64176620961a8c2ec94cdb",
- "action": "add"
- }
- },
- "PythonConnection": {
- "1": {
- "version": 1,
- "hash": "011946fc9af0a6987f5c7bc9b0208b2fae9d65217531430bced7ba542788da1a",
- "action": "add"
- }
- },
- "DateTime": {
- "1": {
- "version": 1,
- "hash": "7e9d89309a10d2110a7ae4f97d8f25a7914853269e8fa0c531630790c1253f17",
- "action": "add"
- }
- },
- "BlobFile": {
- "1": {
- "version": 1,
- "hash": "47ed55183d619c6c624e35412360a41de42833e2c24223c1de1ad12a84fdafc2",
- "action": "add"
- }
- },
- "SecureFilePathLocation": {
- "1": {
- "version": 1,
- "hash": "7febc066e2ee5a3a4a891720afede3f5c155cacc0557662ac4d04bf67b964c6d",
- "action": "add"
- }
- },
- "SeaweedSecureFilePathLocation": {
- "1": {
- "version": 1,
- "hash": "5724a38b1a92b8a55da3d9cc34a720365a6d0c32683acda630fc44067173e201",
- "action": "add"
- }
- },
- "BlobStorageEntry": {
- "1": {
- "version": 1,
- "hash": "9f1b027cce390ee6f71c7a81e7420bb71a477b29c6c62ba74e781a97bc5434e6",
- "action": "add"
- }
- },
- "BlobStorageMetadata": {
- "1": {
- "version": 1,
- "hash": "6888943be3f97186190dd26d7eefbdf29b15c6f2fa459e13608065ebcdb799e2",
- "action": "add"
- }
- },
- "CreateBlobStorageEntry": {
- "1": {
- "version": 1,
- "hash": "61a373336e83645f1b6d78a320323d9ea4ee91b3d87b730cb0608fbfa0072262",
- "action": "add"
- }
- },
- "BlobRetrieval": {
- "1": {
- "version": 1,
- "hash": "a8d7e1d6483e7a9b5a130e837fa398862aa6cbb316cc5f4470450d835755fdd9",
- "action": "add"
- }
- },
- "SyftObjectRetrieval": {
- "1": {
- "version": 1,
- "hash": "7ccc62d5b434d2d438b3df661b4d753b0c7c8d593d451d8b86d364da83998c89",
- "action": "add"
- }
- },
- "BlobRetrievalByURL": {
- "1": {
- "version": 1,
- "hash": "18fd860cb9de296532fc9ff075932e6a4377cc8f043dd88ed4f620517321077d",
- "action": "add"
- }
- },
- "BlobDeposit": {
- "1": {
- "version": 1,
- "hash": "c98e6da658a3be01ead4ea6ee6a4c10046879f0ce0f5fc5f946346671579b229",
- "action": "add"
- }
- },
- "WorkerSettings": {
- "1": {
- "version": 1,
- "hash": "0dcd95422ec8a7c74e45ee68a125084c08f898dc94a13d25fe5a5fd0e4fc5027",
- "action": "add"
- }
- },
- "HTTPNodeRoute": {
- "1": {
- "version": 1,
- "hash": "199423cebb9427d22a5c0e4e2210230be6c64d2996aa35a1d6f7677d0ebf945d",
- "action": "add"
- }
- },
- "PythonNodeRoute": {
- "1": {
- "version": 1,
- "hash": "4ad5eccc9e849c81bd7a6f18199cd434a7eab107c07a6ff3a870d561ae99e69e",
- "action": "add"
- }
- },
- "EnclaveMetadata": {
- "1": {
- "version": 1,
- "hash": "39f85e475015e6f860ddcc5fea819423eba2db8f4b7d8e004c05a44d6f8444c6",
- "action": "add"
- }
- },
- "DataSubject": {
- "1": {
- "version": 1,
- "hash": "0b8b049d4627727b444c419f5d6a97b7cb97a433088ebf744c854b6a470dadf1",
- "action": "add"
- }
- },
- "DataSubjectCreate": {
- "1": {
- "version": 1,
- "hash": "5a94f9fcba75c50d78d71222f0235c5fd4d8003ae0db4d74bdbc4d56a99de3aa",
- "action": "add"
- }
- },
- "DataSubjectMemberRelationship": {
- "1": {
- "version": 1,
- "hash": "0a820edc9f1a87387acc3c611fe852752fcb3dab7608058f2bc48211be7bfbd2",
- "action": "add"
- }
- },
- "Contributor": {
- "1": {
- "version": 1,
- "hash": "d1d4f25bb87e59c0414501d3335097de66815c164c9ed5a7850ff8bec69fbcdc",
- "action": "add"
- }
- },
- "MarkdownDescription": {
- "1": {
- "version": 1,
- "hash": "519328a3952049f57004013e4fb00840695b24b8575cad983056412c9c9d9ba6",
- "action": "add"
- }
- },
- "Asset": {
- "1": {
- "version": 1,
- "hash": "24350b8d9597df49999918ad42e0eece1328ea30389311f1e0a420be8f39b8a1",
- "action": "add"
- }
- },
- "CreateAsset": {
- "1": {
- "version": 1,
- "hash": "1b4c71569b8da64258672483bd36dc4aa99a32d4cb519659241d15bc898041a6",
- "action": "add"
- }
- },
- "Dataset": {
- "1": {
- "version": 1,
- "hash": "99ca2fa3e46fd9810222d269fac6accb546f632e94d5d57529016ba5e55af5a8",
- "action": "add"
- }
- },
- "DatasetPageView": {
- "1": {
- "version": 1,
- "hash": "68c7a0c3e7796fdabb8f732c6d150ec4a8071ce78d69b30da18393afdcea1e59",
- "action": "add"
- }
- },
- "CreateDataset": {
- "1": {
- "version": 1,
- "hash": "3b020d9b8928cbd7e91f41c749ab4c932e19520696a183f2c7cd1312ebb640d1",
- "action": "add"
- }
- },
- "ActionDataEmpty": {
- "1": {
- "version": 1,
- "hash": "89b5912fe5416f922051b8068be6071a03c87a4ab264959de524f1b86e95f028",
- "action": "add"
- }
- },
- "ActionFileData": {
- "1": {
- "version": 1,
- "hash": "1f32d94b75b0a6b4e86cec93d94aa905738219e3e7e75f51dd335ee832a6ed3e",
- "action": "add"
- }
- },
- "Action": {
- "1": {
- "version": 1,
- "hash": "5cf71ee35097f17fbb1dd05096f875211d71cf07161205d7f6a9c11fd49d5272",
- "action": "add"
- }
- },
- "ActionObject": {
- "1": {
- "version": 1,
- "hash": "632446f1415102490c93fafb56dd9eb29d79623bcc5e9f2e6e37c4f63c2c51c3",
- "action": "add"
- }
- },
- "AnyActionObject": {
- "1": {
- "version": 1,
- "hash": "bcb31f847907edc9c95d2d120dc5427854604f40940e3f41cd0474a1820ac65e",
- "action": "add"
- }
- },
- "TwinObject": {
- "1": {
- "version": 1,
- "hash": "c42455586b43724a7421becd99122b787a129798daf6081e96954ecaea228099",
- "action": "add"
- }
- },
- "ExactMatch": {
- "1": {
- "version": 1,
- "hash": "e497e2e2380db72766c5e219e8afd13136d8953933d6f1eaf83b14001e887cde",
- "action": "add"
- }
- },
- "OutputHistory": {
- "1": {
- "version": 1,
- "hash": "4ec6e6efd86a972b474251885151bdfe4ef262562174605e8ab6a8abba1aa867",
- "action": "add"
- }
- },
- "OutputPolicyExecuteCount": {
- "1": {
- "version": 1,
- "hash": "6bb24b3b35e19564c43b838ca3f46ccdeadb6596511917f2d220681a378e439d",
- "action": "add"
- }
- },
- "OutputPolicyExecuteOnce": {
- "1": {
- "version": 1,
- "hash": "32a40fc9966b277528eebc61c01041f3a5447417731954abdaffbb14dabc76bb",
- "action": "add"
- }
- },
- "UserPolicy": {
- "1": {
- "version": 1,
- "hash": "c69b17b1d96cace8b45da6d9639165f2da4aa7ff156b6fd922ac217bf7856d8a",
- "action": "add"
- }
- },
- "SubmitUserPolicy": {
- "1": {
- "version": 1,
- "hash": "96f7f39279fadc70c569b8d48ed4d6420a8132db51e37466d272fda19953554b",
- "action": "add"
- }
- },
- "UserCode": {
- "1": {
- "version": 1,
- "hash": "e14c22686cdc7d1fb2b0d01c0aebdea37e62a61b051677c1d30234214f05cd42",
- "action": "add"
- }
- },
- "SubmitUserCode": {
- "1": {
- "version": 1,
- "hash": "f572d32350d09e25b29572c591029d37a216818618c383094404f84bc9c15dd6",
- "action": "add"
- }
- },
- "UserCodeExecutionResult": {
- "1": {
- "version": 1,
- "hash": "49c32e85e78b7b189a7f13b7e26115ef94fcb0b60b578adcbe2b95e289f63a6e",
- "action": "add"
- }
- },
- "CodeHistory": {
- "1": {
- "version": 1,
- "hash": "a7baae93862ae0aa67675f1617574e31aafb15a9ebff633eb817278a3a867161",
- "action": "add"
- }
- },
- "CodeHistoryView": {
- "1": {
- "version": 1,
- "hash": "0ed1a2a04a962ecbcfa38b0b8a03c1e51e8946a4b80f6bf2557148ce658671ce",
- "action": "add"
- }
- },
- "CodeHistoriesDict": {
- "1": {
- "version": 1,
- "hash": "95288411cd5843834f3273a2fd66a7df2e603e980f4ab1d329f9ab17d5d2f643",
- "action": "add"
- }
- },
- "UsersCodeHistoriesDict": {
- "1": {
- "version": 1,
- "hash": "5e1f389c4565ee8558386dd5c934d81e0c68ab1434f86bb9065976b587ef44d1",
- "action": "add"
- }
- },
- "NodePeer": {
- "1": {
- "version": 1,
- "hash": "50c5b7867d450c1af8011830339c07f5e7bd92589daeac976e0ab86151082cbc",
- "action": "add"
- }
- },
- "CommandReport": {
- "1": {
- "version": 1,
- "hash": "81c6f248e89f6191f75afb7170f82b616377ae46c1d809f6047e13c6f2f299d5",
- "action": "add"
- }
- },
- "CommandResult": {
- "1": {
- "version": 1,
- "hash": "65588691901dc0562afb650b0abe04fe6e3e3db516abda3ec82a371ce459ed0d",
- "action": "add"
- }
- },
- "VPNClientConnection": {
- "1": {
- "version": 1,
- "hash": "cf12dcf5066e6c441e6841ae24bd295d8331e7920c79473bfabc17c5e47cf79e",
- "action": "add"
- }
- },
- "HeadscaleAuthToken": {
- "1": {
- "version": 1,
- "hash": "d88dbe672feb126eb1c5f36208edb1effcfe8721fb6619a9ac62ed3fff8f1546",
- "action": "add"
- }
- },
- "TailscalePeer": {
- "1": {
- "version": 1,
- "hash": "603da3a1087e8d80a6b7e4cd6ccaccd7e1baf3ec77265d810e3a9e9cd233ac04",
- "action": "add"
- }
- },
- "TailscaleStatus": {
- "1": {
- "version": 1,
- "hash": "52a7bd4b72f160a8b14466e98bb2b2a70c4f49aaff635e844fa40e955f7d76d2",
- "action": "add"
- }
- },
- "OnDiskBlobDeposit": {
- "1": {
- "version": 1,
- "hash": "5efc230c1ee65c4626d334aa69ed458c796c45265e546a333844c6c2bcd0e6b0",
- "action": "add"
- }
- },
- "SeaweedFSBlobDeposit": {
- "1": {
- "version": 1,
- "hash": "382a9ac178deed2a9591e1ebbb39f265cbe67027fb93a420d473a4c26b7fda11",
- "action": "add"
- }
- },
- "DictStoreConfig": {
- "1": {
- "version": 1,
- "hash": "256e9c623ce0becd555ddd2a55a0c15514e162786b1549388cef98a92a9b18c9",
- "action": "add"
- }
- },
- "NumpyArrayObject": {
- "1": {
- "version": 1,
- "hash": "dcc7b44fa5ad22ae0bc576948f856c172dac1e9de2bc8e2a302e428f3309a278",
- "action": "add"
- }
- },
- "NumpyScalarObject": {
- "1": {
- "version": 1,
- "hash": "5c1b6b6e8ba88bc79e76646d621489b889fe8f9b9fd59f117d594be18a409633",
- "action": "add"
- }
- },
- "NumpyBoolObject": {
- "1": {
- "version": 1,
- "hash": "a5c822a6a3ca9eefd6a2b68f7fd0bc614fba7995f6bcc30bdc9dc882296b9b16",
- "action": "add"
- }
- },
- "PandasDataframeObject": {
- "1": {
- "version": 1,
- "hash": "35058924b3de2e0a604a92f91f4dd2e3cc0dac80c219d34f360e7cedd52f5f4c",
- "action": "add"
- }
- },
- "PandasSeriesObject": {
- "1": {
- "version": 1,
- "hash": "2a0d8a55f1c27bd8fccd276cbe01bf272c40cab10417d7027273983fed423caa",
- "action": "add"
- }
- },
- "ReplyNotification": {
- "1": {
- "version": 1,
- "hash": "34b2ad522f7406c2486573467d9c7acef5c1063a0d9f2177c3bda2d8c4f87572",
- "action": "add"
- }
- },
- "Notification": {
- "1": {
- "version": 1,
- "hash": "d13981f721fe2b3e2717640ee07dc716c596e4ecd442461665c3fdab0b85bf0e",
- "action": "add"
- }
- },
- "CreateNotification": {
- "1": {
- "version": 1,
- "hash": "b1f459de374fe674f873a4a5f3fb8a8aabe0d83faad84a933f0a77dd1141159a",
- "action": "add"
- }
- },
- "Change": {
- "1": {
- "version": 1,
- "hash": "aefebd1601cf5bfd4817b0db75300a78299cc4949ead735a90873cbd22c8d4bc",
- "action": "add"
- }
- },
- "ChangeStatus": {
- "1": {
- "version": 1,
- "hash": "627f6f8e42cc285336aa6fd4916285d796140f4ff901487b7cb3907ef0f116a6",
- "action": "add"
- }
- },
- "ActionStoreChange": {
- "1": {
- "version": 1,
- "hash": "17b865e75eb3fb2693924fb00ba87a25260be45d55a4eb2184c4ead22d787cbe",
- "action": "add"
- }
- },
- "Request": {
- "1": {
- "version": 1,
- "hash": "e054307eeb7f13683cde9ce7613d5ca2925a13fff7c345b1c9f729a12c955f90",
- "action": "add"
- }
- },
- "RequestInfo": {
- "1": {
- "version": 1,
- "hash": "b76075c138afc0563ce9ac7f6b1131f048951f7486cd516c02736dc1a2a23639",
- "action": "add"
- }
- },
- "RequestInfoFilter": {
- "1": {
- "version": 1,
- "hash": "7103abdc464ae71bb746410f5730f55dd8ed82268aa32bbb0a69e0070488a669",
- "action": "add"
- }
- },
- "SubmitRequest": {
- "1": {
- "version": 1,
- "hash": "96b4ec12beafd9d8a7c97399cb8a23dade4db16d8f521be3fe7b8fec99db5161",
- "action": "add"
- }
- },
- "ObjectMutation": {
- "1": {
- "version": 1,
- "hash": "0ee3dd38d6df0fe9a19d848e8f3aaaf13a6ba86afe3406c239caed6da185651a",
- "action": "add"
- }
- },
- "EnumMutation": {
- "1": {
- "version": 1,
- "hash": "4c02f956ec9b973064972cc57fc8dd9c525e683f93f804642b4e1bfee1b62e57",
- "action": "add"
- }
- },
- "UserCodeStatusChange": {
- "1": {
- "version": 1,
- "hash": "4f5b405cc2b3976ed8f7018df82e873435d9187dff15fa5a23bc85a738969f3f",
- "action": "add"
- }
- },
- "SyftObjectMigrationState": {
- "1": {
- "version": 1,
- "hash": "d3c8126bc15dae4dd243bb035530e3f56cd9e433d403dd6b5f3b45face6d281f",
- "action": "add"
- }
- },
- "ProjectThreadMessage": {
- "1": {
- "version": 1,
- "hash": "1118e935792e8e54103dbf91fa33edbf192a7767d2b1d4526dfa7d4a643cde2e",
- "action": "add"
- }
- },
- "ProjectMessage": {
- "1": {
- "version": 1,
- "hash": "55a3a5171b6949372b4125cc461bf39bc998565e07703804fca6c7ef99695ae4",
- "action": "add"
- }
- },
- "ProjectRequestResponse": {
- "1": {
- "version": 1,
- "hash": "d4c360e845697a0b24695143d0781626cd344cfde43162c90ae90fe67e00ae21",
- "action": "add"
- }
- },
- "ProjectRequest": {
- "1": {
- "version": 1,
- "hash": "514d189df335c68869eea36befcdcafec74bdc682eaf18871fe879e26da4dbb6",
- "action": "add"
- }
- },
- "AnswerProjectPoll": {
- "1": {
- "version": 1,
- "hash": "ff2e1ac7bb764c99d646b96eb3ebfbf9311599b7e3be07aa4a4eb4810bb6dd12",
- "action": "add"
- }
- },
- "ProjectPoll": {
- "1": {
- "version": 1,
- "hash": "b0ac8f1d9c06997374ddbc33fdf1d0af0da15fdb6899f52d91a8574106558964",
- "action": "add"
- }
- },
- "Project": {
- "1": {
- "version": 1,
- "hash": "ec5b7ac1c92808e266f06b175c6ebcd50be81777ad120c02ce8c6074d0004788",
- "action": "add"
- }
- },
- "ProjectSubmit": {
- "1": {
- "version": 1,
- "hash": "0374b37779497d7e0b2ffeabc38d35bfbae2ee762a7674a5a8af75e7c5545e61",
- "action": "add"
- }
- },
- "QueueItem": {
- "1": {
- "version": 1,
- "hash": "5aa94681d9d0715d5b605f9625a54e114927271378cf2ea7245f85c488035e0b",
- "action": "add"
- }
- },
- "ZMQClientConfig": {
- "1": {
- "version": 1,
- "hash": "e6054969b495791569caaf33239039beae3d116e1fe74e9575467c48b9007c45",
- "action": "add"
- }
- },
- "SQLiteStoreConfig": {
- "1": {
- "version": 1,
- "hash": "b656b26c14cf4e97aba702dd62a0927aec7f860c12eed512c2c688e1b7109aa5",
- "action": "add"
- }
- },
- "Plan": {
- "1": {
- "version": 1,
- "hash": "a0bba2b7792c9e08c453e9e256f0ac6e6185610726566bcd50b057ae83b42d9a",
- "action": "add"
- }
- }
- }
- }
-}
+{}
diff --git a/packages/syft/src/syft/service/metadata/migrations.py b/packages/syft/src/syft/service/metadata/migrations.py
index 2097db8cb45..91cabf0357d 100644
--- a/packages/syft/src/syft/service/metadata/migrations.py
+++ b/packages/syft/src/syft/service/metadata/migrations.py
@@ -7,11 +7,11 @@
from ...types.transforms import drop
from ...types.transforms import rename
from .node_metadata import NodeMetadata
-from .node_metadata import NodeMetadataV1
from .node_metadata import NodeMetadataV2
+from .node_metadata import NodeMetadataV3
-@migrate(NodeMetadataV1, NodeMetadataV2)
+@migrate(NodeMetadata, NodeMetadataV2)
def upgrade_metadata_v1_to_v2():
return [
rename("highest_object_version", "highest_version"),
@@ -19,7 +19,7 @@ def upgrade_metadata_v1_to_v2():
]
-@migrate(NodeMetadataV2, NodeMetadataV1)
+@migrate(NodeMetadataV2, NodeMetadata)
def downgrade_metadata_v2_to_v1():
return [
rename("highest_version", "highest_object_version"),
@@ -27,7 +27,7 @@ def downgrade_metadata_v2_to_v1():
]
-@migrate(NodeMetadataV2, NodeMetadata)
+@migrate(NodeMetadataV2, NodeMetadataV3)
def upgrade_metadata_v2_to_v3():
return [drop(["deployed_on", "on_board", "signup_enabled", "admin_email"])]
@@ -50,6 +50,6 @@ def set_defaults_from_settings(context: TransformContext) -> TransformContext:
return set_defaults_from_settings
-@migrate(NodeMetadata, NodeMetadataV2)
+@migrate(NodeMetadataV3, NodeMetadataV2)
def downgrade_metadata_v3_to_v2():
return [_downgrade_metadata_v3_to_v2()]
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index 81ef89f9057..655450fa4b2 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -47,7 +47,7 @@ def check_version(
@serializable()
-class NodeMetadataUpdateV1(SyftObject):
+class NodeMetadataUpdate(SyftObject):
__canonical_name__ = "NodeMetadataUpdate"
__version__ = SYFT_OBJECT_VERSION_1
@@ -64,7 +64,7 @@ class NodeMetadataUpdateV1(SyftObject):
@serializable()
-class NodeMetadataUpdate(SyftObject):
+class NodeMetadataUpdateV2(SyftObject):
__canonical_name__ = "NodeMetadataUpdate"
__version__ = SYFT_OBJECT_VERSION_2
@@ -80,7 +80,7 @@ class NodeMetadataUpdate(SyftObject):
@serializable()
-class NodeMetadataV1(SyftObject):
+class NodeMetadata(SyftObject):
__canonical_name__ = "NodeMetadata"
__version__ = SYFT_OBJECT_VERSION_1
@@ -138,7 +138,7 @@ def check_version(self, client_version: str) -> bool:
@serializable()
-class NodeMetadata(SyftObject):
+class NodeMetadataV3(SyftObject):
__canonical_name__ = "NodeMetadata"
__version__ = SYFT_OBJECT_VERSION_3
@@ -193,7 +193,7 @@ def check_version(self, client_version: str) -> bool:
)
-@transform(NodeMetadata, NodeMetadataJSON)
+@transform(NodeMetadataV3, NodeMetadataJSON)
def metadata_to_json() -> List[Callable]:
return [
drop(["__canonical_name__"]),
@@ -204,7 +204,7 @@ def metadata_to_json() -> List[Callable]:
]
-@transform(NodeMetadataJSON, NodeMetadata)
+@transform(NodeMetadataJSON, NodeMetadataV3)
def json_to_metadata() -> List[Callable]:
return [
drop(["metadata_version", "supported_protocols"]),
diff --git a/packages/syft/src/syft/service/network/network_service.py b/packages/syft/src/syft/service/network/network_service.py
index 5d857054bc8..731695215b6 100644
--- a/packages/syft/src/syft/service/network/network_service.py
+++ b/packages/syft/src/syft/service/network/network_service.py
@@ -17,7 +17,7 @@
from ...node.credentials import SyftVerifyKey
from ...node.worker_settings import WorkerSettings
from ...serde.serializable import serializable
-from ...service.settings.settings import NodeSettings
+from ...service.settings.settings import NodeSettingsV2
from ...store.document_store import BaseUIDStoreStash
from ...store.document_store import DocumentStore
from ...store.document_store import PartitionKey
@@ -31,7 +31,7 @@
from ...util.telemetry import instrument
from ..context import AuthedServiceContext
from ..data_subject.data_subject import NamePartitionKey
-from ..metadata.node_metadata import NodeMetadata
+from ..metadata.node_metadata import NodeMetadataV3
from ..response import SyftError
from ..response import SyftSuccess
from ..service import AbstractService
@@ -557,14 +557,14 @@ def node_route_to_http_connection(
return HTTPConnection(url=url, proxy_target_uid=obj.proxy_target_uid)
-@transform(NodeMetadata, NodePeer)
+@transform(NodeMetadataV3, NodePeer)
def metadata_to_peer() -> List[Callable]:
return [
keep(["id", "name", "verify_key", "node_type", "admin_email"]),
]
-@transform(NodeSettings, NodePeer)
+@transform(NodeSettingsV2, NodePeer)
def settings_to_peer() -> List[Callable]:
return [
keep(["id", "name", "verify_key", "node_type", "admin_email"]),
diff --git a/packages/syft/src/syft/service/network/node_peer.py b/packages/syft/src/syft/service/network/node_peer.py
index 378cab2a9b0..1fe07af3158 100644
--- a/packages/syft/src/syft/service/network/node_peer.py
+++ b/packages/syft/src/syft/service/network/node_peer.py
@@ -16,7 +16,7 @@
from ...types.syft_object import SyftObject
from ...types.uid import UID
from ..context import NodeServiceContext
-from ..metadata.node_metadata import NodeMetadata
+from ..metadata.node_metadata import NodeMetadataV3
from .routes import NodeRoute
from .routes import NodeRouteType
from .routes import connection_to_route
@@ -55,7 +55,7 @@ def from_client(client: SyftClient) -> Self:
if not client.metadata:
raise Exception("Client has to have metadata first")
- peer = client.metadata.to(NodeMetadata).to(NodePeer)
+ peer = client.metadata.to(NodeMetadataV3).to(NodePeer)
route = connection_to_route(client.connection)
peer.node_routes.append(route)
return peer
diff --git a/packages/syft/src/syft/service/project/project.py b/packages/syft/src/syft/service/project/project.py
index 6a2679694b2..b8cead0264e 100644
--- a/packages/syft/src/syft/service/project/project.py
+++ b/packages/syft/src/syft/service/project/project.py
@@ -31,7 +31,7 @@
from ...node.credentials import SyftVerifyKey
from ...serde.serializable import serializable
from ...serde.serialize import _serialize
-from ...service.metadata.node_metadata import NodeMetadata
+from ...service.metadata.node_metadata import NodeMetadataV3
from ...store.linked_obj import LinkedObject
from ...types.datetime import DateTime
from ...types.identity import Identity
@@ -64,7 +64,7 @@ class EventAlreadyAddedException(SyftException):
pass
-@transform(NodeMetadata, NodeIdentity)
+@transform(NodeMetadataV3, NodeIdentity)
def metadata_to_node_identity() -> List[Callable]:
return [rename("id", "node_id"), rename("name", "node_name")]
@@ -1230,7 +1230,7 @@ def to_node_identity(val: Union[SyftClient, NodeIdentity]):
if isinstance(val, NodeIdentity):
return val
elif isinstance(val, SyftClient):
- metadata = val.metadata.to(NodeMetadata)
+ metadata = val.metadata.to(NodeMetadataV3)
return metadata.to(NodeIdentity)
else:
raise SyftException(
diff --git a/packages/syft/src/syft/service/settings/migrations.py b/packages/syft/src/syft/service/settings/migrations.py
index a97f73d78bf..49dcaf67b02 100644
--- a/packages/syft/src/syft/service/settings/migrations.py
+++ b/packages/syft/src/syft/service/settings/migrations.py
@@ -6,7 +6,7 @@
from ...types.transforms import TransformContext
from ...types.transforms import drop
from .settings import NodeSettings
-from .settings import NodeSettingsV1
+from .settings import NodeSettingsV2
def set_from_node_to_key(node_attr: str, key: str) -> Callable:
@@ -17,7 +17,7 @@ def extract_from_node(context: TransformContext) -> TransformContext:
return extract_from_node
-@migrate(NodeSettingsV1, NodeSettings)
+@migrate(NodeSettings, NodeSettingsV2)
def upgrade_metadata_v1_to_v2():
return [
set_from_node_to_key("verify_key", "verify_key"),
@@ -25,7 +25,7 @@ def upgrade_metadata_v1_to_v2():
]
-@migrate(NodeSettings, NodeSettingsV1)
+@migrate(NodeSettingsV2, NodeSettings)
def downgrade_metadata_v2_to_v1():
return [
drop(["verify_key", "node_type"]),
diff --git a/packages/syft/src/syft/service/settings/settings.py b/packages/syft/src/syft/service/settings/settings.py
index a2efdf29e71..fc16195c0aa 100644
--- a/packages/syft/src/syft/service/settings/settings.py
+++ b/packages/syft/src/syft/service/settings/settings.py
@@ -27,7 +27,7 @@ class NodeSettingsUpdate(PartialSyftObject):
@serializable()
-class NodeSettingsV1(SyftObject):
+class NodeSettings(SyftObject):
__canonical_name__ = "NodeSettings"
__version__ = SYFT_OBJECT_VERSION_1
__repr_attrs__ = [
@@ -50,7 +50,7 @@ class NodeSettingsV1(SyftObject):
@serializable()
-class NodeSettings(SyftObject):
+class NodeSettingsV2(SyftObject):
__canonical_name__ = "NodeSettings"
__version__ = SYFT_OBJECT_VERSION_2
__repr_attrs__ = [
diff --git a/packages/syft/src/syft/service/settings/settings_service.py b/packages/syft/src/syft/service/settings/settings_service.py
index 601003f1ae0..d0e8a92dcef 100644
--- a/packages/syft/src/syft/service/settings/settings_service.py
+++ b/packages/syft/src/syft/service/settings/settings_service.py
@@ -19,8 +19,8 @@
from ..service import AbstractService
from ..service import service_method
from ..warnings import HighSideCRUDWarning
-from .settings import NodeSettings
from .settings import NodeSettingsUpdate
+from .settings import NodeSettingsV2
from .settings_stash import SettingsStash
@@ -49,7 +49,7 @@ def get(self, context: UnauthedServiceContext) -> Result[Ok, Err]:
@service_method(path="settings.set", name="set")
def set(
- self, context: AuthedServiceContext, settings: NodeSettings
+ self, context: AuthedServiceContext, settings: NodeSettingsV2
) -> Result[Ok, Err]:
"""Set a new the Node Settings"""
print("Here!")
diff --git a/packages/syft/src/syft/service/settings/settings_stash.py b/packages/syft/src/syft/service/settings/settings_stash.py
index 924e2915d93..35aa58486e8 100644
--- a/packages/syft/src/syft/service/settings/settings_stash.py
+++ b/packages/syft/src/syft/service/settings/settings_stash.py
@@ -13,7 +13,7 @@
from ...store.document_store import PartitionSettings
from ...types.uid import UID
from ...util.telemetry import instrument
-from .settings import NodeSettings
+from .settings import NodeSettingsV2
NamePartitionKey = PartitionKey(key="name", type_=str)
ActionIDsPartitionKey = PartitionKey(key="action_ids", type_=List[UID])
@@ -22,17 +22,17 @@
@instrument
@serializable()
class SettingsStash(BaseUIDStoreStash):
- object_type = NodeSettings
+ object_type = NodeSettingsV2
settings: PartitionSettings = PartitionSettings(
- name=NodeSettings.__canonical_name__, object_type=NodeSettings
+ name=NodeSettingsV2.__canonical_name__, object_type=NodeSettingsV2
)
def __init__(self, store: DocumentStore) -> None:
super().__init__(store=store)
def set(
- self, credentials: SyftVerifyKey, settings: NodeSettings
- ) -> Result[NodeSettings, str]:
+ self, credentials: SyftVerifyKey, settings: NodeSettingsV2
+ ) -> Result[NodeSettingsV2, str]:
res = self.check_type(settings, self.object_type)
# we dont use and_then logic here as it is hard because of the order of the arguments
if res.is_err():
@@ -40,8 +40,8 @@ def set(
return super().set(credentials=credentials, obj=res.ok())
def update(
- self, credentials: SyftVerifyKey, settings: NodeSettings
- ) -> Result[NodeSettings, str]:
+ self, credentials: SyftVerifyKey, settings: NodeSettingsV2
+ ) -> Result[NodeSettingsV2, str]:
res = self.check_type(settings, self.object_type)
# we dont use and_then logic here as it is hard because of the order of the arguments
if res.is_err():
diff --git a/packages/syft/tests/syft/settings/fixtures.py b/packages/syft/tests/syft/settings/fixtures.py
index b8668483e13..5d66447d71f 100644
--- a/packages/syft/tests/syft/settings/fixtures.py
+++ b/packages/syft/tests/syft/settings/fixtures.py
@@ -10,8 +10,8 @@
from syft.abstract_node import NodeType
from syft.node.credentials import SyftSigningKey
from syft.service.metadata.node_metadata import NodeMetadataJSON
-from syft.service.settings.settings import NodeSettings
from syft.service.settings.settings import NodeSettingsUpdate
+from syft.service.settings.settings import NodeSettingsV2
from syft.service.settings.settings_service import SettingsService
from syft.service.settings.settings_stash import SettingsStash
from syft.types.syft_object import HIGHEST_SYFT_OBJECT_VERSION
@@ -25,8 +25,8 @@ def settings_stash(document_store) -> SettingsStash:
@pytest.fixture
-def settings(worker, faker) -> NodeSettings:
- return NodeSettings(
+def settings(worker, faker) -> NodeSettingsV2:
+ return NodeSettingsV2(
id=UID(),
name=worker.name,
organization=faker.text(),
diff --git a/packages/syft/tests/syft/settings/settings_service_test.py b/packages/syft/tests/syft/settings/settings_service_test.py
index 29554527be2..566e3fe5af7 100644
--- a/packages/syft/tests/syft/settings/settings_service_test.py
+++ b/packages/syft/tests/syft/settings/settings_service_test.py
@@ -17,8 +17,8 @@
from syft.service.context import AuthedServiceContext
from syft.service.response import SyftError
from syft.service.response import SyftSuccess
-from syft.service.settings.settings import NodeSettings
from syft.service.settings.settings import NodeSettingsUpdate
+from syft.service.settings.settings import NodeSettingsV2
from syft.service.settings.settings_service import SettingsService
from syft.service.settings.settings_stash import SettingsStash
from syft.service.user.user import UserCreate
@@ -28,7 +28,7 @@
def test_settingsservice_get_success(
monkeypatch: MonkeyPatch,
settings_service: SettingsService,
- settings: NodeSettings,
+ settings: NodeSettingsV2,
authed_context: AuthedServiceContext,
) -> None:
mock_stash_get_all_output = [settings, settings]
@@ -41,7 +41,7 @@ def mock_stash_get_all(credentials) -> Ok:
response = settings_service.get(context=authed_context)
- assert isinstance(response.ok(), NodeSettings)
+ assert isinstance(response.ok(), NodeSettingsV2)
assert response == expected_output
@@ -75,20 +75,20 @@ def mock_stash_get_all_error(credentials) -> Err:
def test_settingsservice_set_success(
settings_service: SettingsService,
- settings: NodeSettings,
+ settings: NodeSettingsV2,
authed_context: AuthedServiceContext,
) -> None:
response = settings_service.set(authed_context, settings)
assert response.is_ok() is True
- assert isinstance(response.ok(), NodeSettings)
+ assert isinstance(response.ok(), NodeSettingsV2)
assert response.ok() == settings
def test_settingsservice_set_fail(
monkeypatch: MonkeyPatch,
settings_service: SettingsService,
- settings: NodeSettings,
+ settings: NodeSettingsV2,
authed_context: AuthedServiceContext,
) -> None:
mock_error_message = "database failure"
@@ -107,8 +107,8 @@ def mock_stash_set_error(credentials, a) -> Err:
def add_mock_settings(
root_verify_key: SyftVerifyKey,
settings_stash: SettingsStash,
- settings: NodeSettings,
-) -> NodeSettings:
+ settings: NodeSettingsV2,
+) -> NodeSettingsV2:
# create a mock settings in the stash so that we can update it
result = settings_stash.partition.set(root_verify_key, settings)
assert result.is_ok()
@@ -124,7 +124,7 @@ def test_settingsservice_update_success(
monkeypatch: MonkeyPatch,
settings_stash: SettingsStash,
settings_service: SettingsService,
- settings: NodeSettings,
+ settings: NodeSettingsV2,
update_settings: NodeSettingsUpdate,
authed_context: AuthedServiceContext,
) -> None:
@@ -194,7 +194,7 @@ def test_settingsservice_update_stash_empty(
def test_settingsservice_update_fail(
monkeypatch: MonkeyPatch,
- settings: NodeSettings,
+ settings: NodeSettingsV2,
settings_service: SettingsService,
update_settings: NodeSettingsUpdate,
authed_context: AuthedServiceContext,
@@ -210,7 +210,7 @@ def mock_stash_get_all(credentials) -> Ok:
mock_update_error_message = "Failed to update obj NodeMetadata"
- def mock_stash_update_error(credentials, update_settings: NodeSettings) -> Err:
+ def mock_stash_update_error(credentials, update_settings: NodeSettingsV2) -> Err:
return Err(mock_update_error_message)
monkeypatch.setattr(settings_service.stash, "update", mock_stash_update_error)
@@ -227,7 +227,7 @@ def test_settings_allow_guest_registration(
# Create a new worker
verify_key = SyftSigningKey.generate().verify_key
- mock_node_settings = NodeSettings(
+ mock_node_settings = NodeSettingsV2(
name=faker.name(),
verify_key=verify_key,
highest_version=1,
@@ -310,7 +310,7 @@ def get_mock_client(faker, root_client, role):
return guest_client
verify_key = SyftSigningKey.generate().verify_key
- mock_node_settings = NodeSettings(
+ mock_node_settings = NodeSettingsV2(
name=faker.name(),
verify_key=verify_key,
highest_version=1,
diff --git a/packages/syft/tests/syft/settings/settings_stash_test.py b/packages/syft/tests/syft/settings/settings_stash_test.py
index 68d9ea73f42..f1abc406a68 100644
--- a/packages/syft/tests/syft/settings/settings_stash_test.py
+++ b/packages/syft/tests/syft/settings/settings_stash_test.py
@@ -1,14 +1,14 @@
# third party
# syft absolute
-from syft.service.settings.settings import NodeSettings
from syft.service.settings.settings import NodeSettingsUpdate
+from syft.service.settings.settings import NodeSettingsV2
from syft.service.settings.settings_stash import SettingsStash
def add_mock_settings(
- root_verify_key, settings_stash: SettingsStash, settings: NodeSettings
-) -> NodeSettings:
+ root_verify_key, settings_stash: SettingsStash, settings: NodeSettingsV2
+) -> NodeSettingsV2:
# prepare: add mock settings
result = settings_stash.partition.set(root_verify_key, settings)
assert result.is_ok()
@@ -20,13 +20,13 @@ def add_mock_settings(
def test_settingsstash_set(
- root_verify_key, settings_stash: SettingsStash, settings: NodeSettings
+ root_verify_key, settings_stash: SettingsStash, settings: NodeSettingsV2
) -> None:
result = settings_stash.set(root_verify_key, settings)
assert result.is_ok()
created_settings = result.ok()
- assert isinstance(created_settings, NodeSettings)
+ assert isinstance(created_settings, NodeSettingsV2)
assert created_settings == settings
assert settings.id in settings_stash.partition.data
@@ -34,7 +34,7 @@ def test_settingsstash_set(
def test_settingsstash_update(
root_verify_key,
settings_stash: SettingsStash,
- settings: NodeSettings,
+ settings: NodeSettingsV2,
update_settings: NodeSettingsUpdate,
) -> None:
# prepare: add a mock settings
@@ -50,5 +50,5 @@ def test_settingsstash_update(
assert result.is_ok()
updated_settings = result.ok()
- assert isinstance(updated_settings, NodeSettings)
+ assert isinstance(updated_settings, NodeSettingsV2)
assert mock_settings == updated_settings
From c35217df4e24324e2966d76501d37850382131b5 Mon Sep 17 00:00:00 2001
From: Shubham Gupta
Date: Wed, 1 Nov 2023 13:16:23 +0530
Subject: [PATCH 22/23] update protocol state
---
.../src/syft/protocol/protocol_version.json | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/packages/syft/src/syft/protocol/protocol_version.json b/packages/syft/src/syft/protocol/protocol_version.json
index 41761d9890d..f28c32c12da 100644
--- a/packages/syft/src/syft/protocol/protocol_version.json
+++ b/packages/syft/src/syft/protocol/protocol_version.json
@@ -749,5 +749,23 @@
}
}
}
+ },
+ "dev": {
+ "object_versions": {
+ "NodeMetadata": {
+ "3": {
+ "version": 3,
+ "hash": "3cc67abf394a805066a88aef0bea15bde609b9ecbe7ec15172eac5e7a0b7ef7c",
+ "action": "add"
+ }
+ },
+ "NodeSettings": {
+ "2": {
+ "version": 2,
+ "hash": "29a82afcb006a044b6ae04c6ea8a067d145d28b4210bb038ea9fa86ebde108c8",
+ "action": "add"
+ }
+ }
+ }
}
}
From 5660c786916cd8bbb17c9b3ba2c25985fc254cb3 Mon Sep 17 00:00:00 2001
From: Shubham Gupta
Date: Wed, 1 Nov 2023 14:56:35 +0530
Subject: [PATCH 23/23] fix lint
---
packages/syft/src/syft/service/metadata/node_metadata.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/packages/syft/src/syft/service/metadata/node_metadata.py b/packages/syft/src/syft/service/metadata/node_metadata.py
index c226a2cedcc..07cab49c421 100644
--- a/packages/syft/src/syft/service/metadata/node_metadata.py
+++ b/packages/syft/src/syft/service/metadata/node_metadata.py
@@ -189,7 +189,6 @@ def metadata_to_json() -> List[Callable]:
@transform(NodeMetadataJSON, NodeMetadataV3)
-
def json_to_metadata() -> List[Callable]:
return [
drop(["metadata_version", "supported_protocols"]),