Skip to content

Feat/integrate comms#130

Merged
elenaf9 merged 39 commits intodevfrom
feat/integrate-comms
Feb 26, 2021
Merged

Feat/integrate comms#130
elenaf9 merged 39 commits intodevfrom
feat/integrate-comms

Conversation

@elenaf9
Copy link
Copy Markdown
Contributor

@elenaf9 elenaf9 commented Jan 16, 2021

Description of change

Refactor communication actor and integrate it into the stronghold interface.

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How the change has been tested

Added interface tests to read/ write a remote stronghold store.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@elenaf9 elenaf9 force-pushed the feat/integrate-comms branch from ba14850 to 6664251 Compare January 25, 2021 01:44
@nothingismagick
Copy link
Copy Markdown
Contributor

@lucasfernog and @tensor-programming - would love to have you both do an in depth review of this PR, from the perspective of your respective sides of this actor stack.

@elenaf9
Copy link
Copy Markdown
Contributor Author

elenaf9 commented Jan 25, 2021

I am right now doing some refactoring, but I will soon be done with that and then also mark the PR's as ready for review.

@lucasfernog
Copy link
Copy Markdown
Contributor

Please tag me when this is ready :)

@elenaf9 elenaf9 force-pushed the feat/integrate-comms branch 2 times, most recently from b80434e to 9e29b09 Compare February 1, 2021 10:38
@elenaf9
Copy link
Copy Markdown
Contributor Author

elenaf9 commented Feb 2, 2021

@lucasfernog @tensor-programming the PR is ready for review, but the following aspects are not implemented yet / need to be discussed afterwards:

  • what methods should exists in the stronghold interface (currently I only added write_remote_vault, read_remote_store and write_remote_store)
  • the firewall actor is at the moment just a dummy actor that accepts all requests, eventually it should be provided by the user
  • my changes depends on this PR to riker, right now I've set my fork of riker as dependency for development purposes.

@elenaf9 elenaf9 marked this pull request as ready for review February 2, 2021 23:42
@elenaf9 elenaf9 linked an issue Feb 10, 2021 that may be closed by this pull request
@elenaf9 elenaf9 force-pushed the feat/integrate-comms branch from f294d1f to 0fc47b3 Compare February 10, 2021 16:15
let vault_path = &location.vault_path();
let vault_path = vault_path.to_vec();
// check if vault exists
let b = match self
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename these b variables to vault_exists and record_exists?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, should this whole logic be a core stronghold message? like a EnsureVaultExists and EnsureRecordExists - maybe this is useful for consumers too

Copy link
Copy Markdown
Contributor Author

@elenaf9 elenaf9 Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this logical sequence of the messages from the interface for targeting the local client, so this question also concerns those methods. But yes I can imagine that a user might need these dedicated message types when they don't want to automatically create a new vault if the vault path doesn't exist, especially with remote strongholds but also in a local system.
@tensor-programming what do you think about this?

Copy link
Copy Markdown
Contributor

@tensor-programming tensor-programming Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to wonder if we should even allow a user to create a remote vault. Or if there should be some kind of policy for restricting that kind of behavior. Ideally, we would want each user to have access to a select number of vaults based on which paths they know and haven't really considered how we would restrict users inside of a shared stronghold. Perhaps, its something to think about later.

For now it should be ok to just enable the ability to add/create a new vault remotely if the vault doesn't exist and we can restrict/change that behavior later using policies.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, i think this type of policy that you are talking about Tensor could maybe be decided by the Firewall, so the Firewall can be configured for each stronghold individually to allow or reject a SHRequest::CreateNewVault?

Copy link
Copy Markdown
Contributor

@tensor-programming tensor-programming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this looks good.

@elenaf9
Copy link
Copy Markdown
Contributor Author

elenaf9 commented Feb 14, 2021

The tests currently fail until this PR is merged.

@elenaf9 elenaf9 force-pushed the feat/integrate-comms branch from 8053e08 to eed3b75 Compare February 25, 2021 11:49
Copy link
Copy Markdown
Contributor

@tensor-programming tensor-programming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple of questions and minor things really.

One more thing, there are a ton of unwraps in the code that kind of make me uneasy. I know that its kind of hard to deal with these especially when you are implementing an interface or working in a closure. The problem is that theses unwraps will cause panics if the error happens (in most cases these are options). In production that's not necessarily what we want to happen, in other words, some of them should be recoverable errors if possible. I would recommend going back over each of the unwrap cases to make sure that they are absolutely necessary. If you can't remove the unwrap, it might be better to use expect because at least you give the user some information.

@elenaf9 elenaf9 force-pushed the feat/integrate-comms branch from 707cff1 to d1c8547 Compare February 25, 2021 21:17
@elenaf9 elenaf9 merged commit 9c7cba6 into dev Feb 26, 2021
@elenaf9 elenaf9 deleted the feat/integrate-comms branch February 26, 2021 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

communications integration

4 participants