From 1a3f6cf04dd4b271b823679ccf933d32ff3a4aae Mon Sep 17 00:00:00 2001 From: MohamedElmdary Date: Sun, 22 Oct 2023 16:41:03 +0300 Subject: [PATCH 1/6] Add deployments store path arch decision --- .../update_deployments_store_path.md | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md diff --git a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md new file mode 100644 index 0000000000..92e00574c1 --- /dev/null +++ b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md @@ -0,0 +1,43 @@ +# 2. update_deployment_store_path + +Date: 2023-10-22 + +## Status + +Done + +## Context + +Previously we didn't have a way to tell that this gateway related to that deployment. So we decided to make some updates will be listed below in order to being able to group all deployment related stuff in a single path treating path as a folder. + +e.g + +```bash +tfchain + |_ tfkvstore + |_ machines + |_ vm # projectName + |_ testvm # instanceName + |_ testvm + | |_ contracts.json + |_ testvmGateway + |_ contracts.json +``` + +## Decision + +1. For old deployments + + - We added a migration script will be ablied whenever the user tries to list his own deployments + - Migratable deployments will be getting an update in it's contracts data (if needed) + - Migration will applied once for each contract (Write new contract data then remove the old one) + +2. For new deployments + - Updated projectName to match the new pattern for a deployment called `testvm` in projectName called `vm` the new projectName will be `vm/testvm` instead of `vm`. + - Gateways will be stored in the same previous projectName pattern mentioned above. + - Listing will follow the same pattern. After listing all deployments related to a specific projectName (e.g `p1`) let's say we get deployment as follow `[d1, d2]` so we will load deployment of `p1/d1` & `p1/d2` in playground. + - For kubernetes it doesn't use any projectName so the projectName will be the instanceName itself. + +## Consequences + +There is no specific consquences related to this issue but an issue appeared tfchain_graphql#135. From e405726016acbcebfac0b2eb207abe107cec4c2c Mon Sep 17 00:00:00 2001 From: MohamedElmdary Date: Tue, 24 Oct 2023 13:54:48 +0300 Subject: [PATCH 2/6] Fix tfkvstore tree --- .../decisions/update_deployments_store_path.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md index 92e00574c1..b1b464756f 100644 --- a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md +++ b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md @@ -16,10 +16,13 @@ e.g tfchain |_ tfkvstore |_ machines - |_ vm # projectName + | |_ vm # projectName + | |_ testvm # instanceName + | |_ testvm + | |_ contracts.json + |_ gateways + |_ vm # projectName |_ testvm # instanceName - |_ testvm - | |_ contracts.json |_ testvmGateway |_ contracts.json ``` From 5b8053a9029357aaf247bd0c4343f9956d726690 Mon Sep 17 00:00:00 2001 From: MohamedElmdary Date: Tue, 24 Oct 2023 13:59:34 +0300 Subject: [PATCH 3/6] Fix typos and update texts --- .../decisions/update_deployments_store_path.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md index b1b464756f..9ad36de2af 100644 --- a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md +++ b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md @@ -8,7 +8,7 @@ Done ## Context -Previously we didn't have a way to tell that this gateway related to that deployment. So we decided to make some updates will be listed below in order to being able to group all deployment related stuff in a single path treating path as a folder. +Previously we didn't have a way to tell that a gateway is related to a certain virtual machine. So we decided to make some updates will be listed below in order to be able to group all deployments' workloads in a similar path hierarchy. e.g @@ -31,16 +31,17 @@ tfchain 1. For old deployments - - We added a migration script will be ablied whenever the user tries to list his own deployments - - Migratable deployments will be getting an update in it's contracts data (if needed) - - Migration will applied once for each contract (Write new contract data then remove the old one) + - We added a migration script will be applied whenever the user tries to list his own deployments + - Migrated deployments will be getting an update in their contracts' data (if needed) + - Migrating the contracts is done by only one request to update the contract. + - Keys stored on the kvstore on tfchain are migrated by creating a new key and removing the old one. 2. For new deployments - - Updated projectName to match the new pattern for a deployment called `testvm` in projectName called `vm` the new projectName will be `vm/testvm` instead of `vm`. + - The projectName has been updated to match the new pattern for the deployment. For example, if the deployment is called `testvm` in the projectName called `vm` the new projectName will be `vm/testvm` instead of `vm`. - Gateways will be stored in the same previous projectName pattern mentioned above. - - Listing will follow the same pattern. After listing all deployments related to a specific projectName (e.g `p1`) let's say we get deployment as follow `[d1, d2]` so we will load deployment of `p1/d1` & `p1/d2` in playground. - - For kubernetes it doesn't use any projectName so the projectName will be the instanceName itself. + - Listing will follow the same pattern. After listing all deployments related to a specific projectName (e.g `p1`) let's say we got deployments `[d1, d2]` so we will load the deployment of `d1` from the projectName `p1/d1` and the deployment `d2` is the same in the playground. + - For Kubernetes, it doesn't use any projectName so the projectName will be the instanceName itself. ## Consequences -There is no specific consquences related to this issue but an issue appeared tfchain_graphql#135. +There is no specific consequences related. From d6b1d3d036ec3a5bfc60743e1d6ae7082203c30d Mon Sep 17 00:00:00 2001 From: MohamedElmdary Date: Sun, 5 Nov 2023 12:22:18 +0200 Subject: [PATCH 4/6] Move file to playground folder --- .../docs}/decisions/update_deployments_store_path.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename packages/{grid_client/docs/architecture => playground/docs}/decisions/update_deployments_store_path.md (98%) diff --git a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md b/packages/playground/docs/decisions/update_deployments_store_path.md similarity index 98% rename from packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md rename to packages/playground/docs/decisions/update_deployments_store_path.md index 9ad36de2af..70497560af 100644 --- a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md +++ b/packages/playground/docs/decisions/update_deployments_store_path.md @@ -1,4 +1,4 @@ -# 2. update_deployment_store_path +# 1. update_deployment_store_path Date: 2023-10-22 From 6148c160bba5dc6e37cc3f3ad20966f3ff9608e3 Mon Sep 17 00:00:00 2001 From: MohamedElmdary Date: Mon, 6 Nov 2023 12:26:38 +0200 Subject: [PATCH 5/6] Add ADR for grid_client --- .../update_deployments_store_path.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md diff --git a/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md new file mode 100644 index 0000000000..c4a1737a13 --- /dev/null +++ b/packages/grid_client/docs/architecture/decisions/update_deployments_store_path.md @@ -0,0 +1,21 @@ +# 2. update_deployment_store_path + +Date: 2023-10-22 + +## Status + +Done + +## Context + +Previously we had no way to group folders so we decided to allow combining related contracts as a folder structure can be used in different project (e.g playground). + +## Decision + +- We are migrating old key to a new one which allows us to combine related contracts together as a folder grouping. +- Pattern: `[network]/[twinId]/[projectName]/[moduleName]/[instanceName]/contracts.json` to `[network]/[twinId]/[moduleName]/[projectName]/[instanceName]/contracts.json` +- Example: `dev/370/vm/machines/testvm/contracts.json` to `dev/370/machines/vm/testvm/contracts.json` + +## Consequences + +There is no specific consequences related. From 5a86b55c2905ae31ca0298e67e9b4eee5feff347 Mon Sep 17 00:00:00 2001 From: MohamedElmdary Date: Thu, 16 Nov 2023 16:30:23 +0200 Subject: [PATCH 6/6] Add support hex based seed --- .../decisions/support_hex_based_seed.md | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 packages/grid_client/docs/architecture/decisions/support_hex_based_seed.md diff --git a/packages/grid_client/docs/architecture/decisions/support_hex_based_seed.md b/packages/grid_client/docs/architecture/decisions/support_hex_based_seed.md new file mode 100644 index 0000000000..900e0c832e --- /dev/null +++ b/packages/grid_client/docs/architecture/decisions/support_hex_based_seed.md @@ -0,0 +1,25 @@ +# 3. support_hex_based_seed.md + +Date: 2023-11-16 + +## Status + +Done + +## Context + +Add support for hex based seed (Aka. hexSeed). Basically it's an algorithm derive a hexSeed from regular mnemonic which can be used while interacting with chain without exposing user's mnemonic. + +Note: Threefold Connector App is using hex based seed so now users can copy their hexSeed and use it directly in our clients + +## Decision + +Currently, We added a `toHexSeed` helper to convert any passed mnemonic into hexSeed and if the user passed hexSeed it stays as it is. + +Example: +mnemonic: "word position fox tonight initial genuine liquid jewel almost craft broom maximum" +hexSeed: "0xd8c3909af2227220a5ad15cc5fe1aeb8bd620b50b96d910220c2062c18b28232" + +## Consequences + +There is no specific consequences related.