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

chore!: simplified public key to identity structure #437

Merged
merged 9 commits into from
Jun 17, 2022

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Jun 15, 2022

Issue being fixed or feature implemented

This is preliminary work for the GroveDB proofs integration. The existing structure of the public key to identity IDs structure has several downsides:

  1. It doesn't allow to implement of efficient proofs since it requires proofs for both identities and public keys
  2. To respond with identities, a separate read from storage requires for each identity, which is not perfect.
  3. Storing identity IDs as cbored array requires reading the whole blob, altering and then storing it back. This makes it impossible to predict fees for such logic since we don't know how many IDs are already there.
  4. If we have too many IDs, there won't be possible to implement pagination.

Removal of unused getIdentityIdsByPublicKeyHash endpoint and using GroveDB references solve those problems.

What was done?

  • Removed getIdentityIdsByPublicKeyHash endpoint.
  • Use GroveDB references to connect public keys to identities
  • Split StateRepository#storeIdentity to StateRepository#createIdentity and StateRepository#updateIdentity to remove extra read operation.
  • Update RS Drive to the latest v0.23-dev (includes fixes, batching and proofs)
  • Moved Identity under key 0 to allow future substructures connected to identity

How Has This Been Tested?

Breaking Changes

getIdentityIdsByPublicKeyHash endpoint is removed. getIdentitiesByPublicKeyHash now responds with an array of identities, instead of an array of cbored arrays of identities.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@shumkov shumkov requested a review from antouhou as a code owner June 15, 2022 16:50
@shumkov shumkov added this to the v0.23.0 milestone Jun 15, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2022

This pull request fixes 2 alerts when merging 7844c0f into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2022

This pull request fixes 2 alerts when merging 2dbc228 into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2022

This pull request fixes 2 alerts when merging 95e9117 into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@shumkov shumkov changed the title chore!: simplify public key to identity structure chore!: simplified public key to identity structure Jun 15, 2022
@lgtm-com
Copy link

lgtm-com bot commented Jun 15, 2022

This pull request fixes 2 alerts when merging 3415c92 into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2022

This pull request fixes 2 alerts when merging a17e5e5 into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2022

This pull request fixes 2 alerts when merging 44b90c9 into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2022

This pull request fixes 2 alerts when merging a8d5736 into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 17, 2022

This pull request fixes 2 alerts when merging bd9f0fb into 748320c - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

@shumkov shumkov requested a review from shuplenkov June 17, 2022 10:33
@shumkov shumkov merged commit a9fd1b9 into v0.23-dev Jun 17, 2022
@shumkov shumkov deleted the simplify-public-key-to-identity-structure branch June 17, 2022 10:54
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.

2 participants