Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vaults should have default nodes acting as remotes #208

Closed
5 tasks
CMCDragonkai opened this issue Jul 9, 2021 · 12 comments
Closed
5 tasks

Vaults should have default nodes acting as remotes #208

CMCDragonkai opened this issue Jul 9, 2021 · 12 comments
Assignees
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management

Comments

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jul 9, 2021

Specification

  1. Doing pk vault pull some-vault should default to a particular node id
  2. This should be the equivalent of git remotes, but we don't have to use the remote system in isogit for this, we could have this be tracked inside the vaultmanager system
  3. Should evaluate if git remotes can be used for this though

Additional context

See the developer environment usecase

Tasks

  1. - Change vaultIds from random bytes to a generated uuid with the nodeId appended (this will mean the nodeId will have to be passed into VM)
  2. - When using the clone function, ensure that the new vault has the same vaultId as the vault it was cloned from (plus the appended nodeId)
  3. - Change the pull function to look up the linked node in the node map (by default it should have the vault that it was cloned from
  4. - Write a function that updates the default node Id for a given vault
  5. - Write tests for default pulling and updating linked node id

Resolved in https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/205

@CMCDragonkai CMCDragonkai added the development Standard development label Jul 9, 2021
@CMCDragonkai CMCDragonkai added this to the Release Polykey CLI 1.0.0 milestone Jul 9, 2021
@CMCDragonkai
Copy link
Member Author

Note that use git branch -vv to see how branches are related to remotes.

Our vault have only 1 branch, that being of master.

They should then be able to pull from a default NodeId to reduce friction.

This default remote can be updated to point to another NodeId.

@scottmmorris
Copy link
Contributor

This may need a reworking of the current GitManager class. I realise this may have been the better way to do this from the beginning.

  • User passes in the vaultName of the local vault to pull updates to
  • Call getVaultId to retreive the Id of the local vault to pull updates to
  • Pass the vaultId of the local vault to pull updates to int GitManager pullVault function
  • The vault map can then maintain details about the default remote locations to pull from
  • GitManager looks up the linked nodeId and connects to that node
  • GitManager looks up the linked vaultId

Here we run into a problems in that names can be changed. Ids though remain the same which means you could store the remote as a vaultId, meaning you would also need to store the nodeId. However If you wanted to change the default nodeId you would have to know the vaultId of the vault linked to the original vault of the original node., This becomes too complicated.

Here is the proposal:

  • VaultMap maintains a VaultId -> VaultLink connection
  • The VaultLink contains the nodeId of the default remote and the VaultId of the original cloned vault
  • On initializing a vault, the nodeId is set as the nodes own nodeId and the vaultId is set as the vaultId of the vault in question
  • When cloning a vault, the nodeID of the connected remote is stored in the vault map but the vaultId is obtained from the vault that it connected to
  • When pulling, the nodeId and vaultId is looked up to connect and pull the write information

@scottmmorris
Copy link
Contributor

Although should you even be able to pull changes from a vault that is not the original vault? Does iso-git even allow this? I will test now.

@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Jul 13, 2021 via email

@scottmmorris
Copy link
Contributor

The vault id of a cloned vault is currently not preserved between nodes, if it was then this might cause conflicts. For example if a node clones the same vault twice, they would end up with an error as they own two vaults with the same vault id.

As in my comment above wouldn't it be better to maintain a copy of the original vault id in the vault map which can be referred to when cloning?

@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Jul 14, 2021 via email

@scottmmorris
Copy link
Contributor

Ensuring that all vault IDs are different across keynodes means you have to do bookkeeping on which vault id you are tracking. But is this necessary?

We can make vaultids never conflict by making use of the NodeId. That is the essence of flakeids.

It's necessary in the case above? If a keynode wants to have two separate vaults that are cloned from the same source. I can imagine this might be useful in some cases as we don't provide the option of creating new branches from a single vault yet.

What do you mean by that last part? I'm talking about the case where a keynode has the same vault id stored locally so they would both come under the same node id right?

@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Jul 14, 2021 via email

@CMCDragonkai
Copy link
Member Author

While we are refactoring the vaults domain and encryptedfs domain:

This problem can still be specced out from the UI/UX point of view of the CLI and GUI.

But earnest effort on all of these vault issues will probably be dealt with in a bulk refactoring and layering on new features.

@CMCDragonkai
Copy link
Member Author

  • Git merging has lots of edgecases to deal with
  • To keep it simple, we can maintain the same vault ID across all the keynodes that are sharing a vault
  • Then we should be remembering what is the last node id it was pulled/cloned from, that will automate pulling without needing to specify the node id each time (later this can be generalized to the gestalt)
  • When pulling a vault, we need to ensure that the merge is a "fast forward merge", if it is not, the merge is dropped or not completed, this is fine as we want to preserve linear history and simplify the sharing semantics https://www.atlassian.com/git/tutorials/using-branches/git-merge

@CMCDragonkai CMCDragonkai removed their assignment Jul 26, 2021
@CMCDragonkai
Copy link
Member Author

Done by the merging of vaultsrefactoring https://gitlab.com/MatrixAI/Engineering/Polykey/js-polykey/-/merge_requests/205

@CMCDragonkai
Copy link
Member Author

Reference docs to be updated here: https://github.com/MatrixAI/js-polykey/issues/258

@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management label Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management
Development

No branches or pull requests

2 participants