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

Adding abstractions for the omni-account in the worker #3116

Merged
merged 48 commits into from
Oct 16, 2024

Conversation

silva-fj
Copy link
Contributor

@silva-fj silva-fj commented Oct 4, 2024

This PR introduces some abstractions related to the omni-account in the worker.

The main changes in this PR are:

  • New primitive types (related to omni-account).
  • Litentry core abstractions: OmniAccountRepository is an abstraction to request data from the parachain and InMemoryStore is an abstraction to store and manage the OmniAccount Members in RAM.
  • Optional header parameter to get_storage_keys.

TODO:

  • Replace usage of state key repository with the new key repository (aes256 key) for the on-chain data encryption.

Copy link

linear bot commented Oct 4, 2024

@silva-fj silva-fj changed the title Transition to in-memory IDGraphs in the worker Adding abstractions and dependencies for in-memory AccountsStore (omni-account) in the worker Oct 8, 2024
@silva-fj silva-fj marked this pull request as ready for review October 9, 2024 13:30
@silva-fj
Copy link
Contributor Author

Thanks!

I'm a bit confused about all the changes in StfExecutor, why would we need those? I naively assume in the in-RAM AccoutStore has nothing to do with sidechain state (thus stf), so mutation of it doesn't need to go through the stf executor. Is it the case?

The idea was that when handling a trusted call, we are able to:

  1. Query the latest state of the AccountStore to be sure we have the latest hash before sending the extrinsic to mutate it. (We could rely on the InMemoryStore for this), this is the reason for injecting the ocall_api and the parentchain header.
  2. We need to be able to encrypt the data before sending the extrinsics and decrypt the data when handling trusted getters. So we inject the encryption key repository.

Does it makes sense? Do you had another approach in mind?

@silva-fj
Copy link
Contributor Author

Another approach could be:

  • We keep the data unencrypted in the InMemoryStore, so we won't need to decrypt it for the trusted getters.
  • We rely on the InMemoryStore to get the current AccountStore and hash when handling the trusted calls.
  • We create a channel/thread that would be responsible for encrypting the data and sending the extrinsics to the parachain. So when handling the trusted call we verify and send the message to this channel. The problem with this is that we won't be able to wait until it's included in the block.

This way we won't need to inject anything into the executor. What do you guys think? Any other ideas? @Kailai-Wang @kziemianek

@silva-fj silva-fj changed the title Adding abstractions and dependencies for in-memory AccountsStore (omni-account) in the worker Adding abstractions for the omni-account in the worker Oct 10, 2024
@silva-fj silva-fj enabled auto-merge (squash) October 16, 2024 09:10
@silva-fj silva-fj merged commit 302f865 into dev Oct 16, 2024
19 checks passed
@silva-fj silva-fj deleted the p-1086-transition-to-ram-idgraph-use-in-worker branch October 16, 2024 10:44
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.

3 participants