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

[PKI] Organaze storage-related logic in x/pki app module better #51

Closed
spivachuk opened this issue Sep 21, 2020 · 2 comments
Closed

[PKI] Organaze storage-related logic in x/pki app module better #51

spivachuk opened this issue Sep 21, 2020 · 2 comments

Comments

@spivachuk
Copy link
Contributor

spivachuk commented Sep 21, 2020

Now in x/pki app module Keeper handles addition of unique certificate keys separately from addition of certificates. However, unique certificate keys are registered at the same moments when certificates are added / proposed. Actually unique certificate keys are just additional indexes of certificates. So it makes sense to put addition / proposal of a certificate and addition of the unique certificate key into one operation (addition / proposal of a certificate correspondingly).

Also it makes sense to move logic currently located in addChildCertificateEntry and removeChildCertificateEntry methods of Handler to Keeper.

@spivachuk spivachuk changed the title Organaze storage-related logic in x/pki app module better [PKI] Organaze storage-related logic in x/pki app module better Sep 21, 2020
@ashcherbakov ashcherbakov added this to the v0.4 milestone Sep 28, 2020
@ashcherbakov
Copy link
Contributor

We need to define the rule for the boundaries between a Keeper and a Handler (not for PKI module only).
I think the rule can be the following:

  • A Handler's method should consist of two parts:
    • validation (can call Keeper if needed)
    • call one (and only one) Keeper's method to store the entity in the State
  • A Keeper's method for storing entities must make it in an "atomic" way so that it
    • stores the main entity in the state
    • create or update additional entities or indices

@ashcherbakov ashcherbakov removed this from the v0.4 milestone Nov 1, 2021
@ashcherbakov
Copy link
Contributor

#157
Keeprs contain methods to work with one key only.
Handlers (Msg Servers) contain business logic to potentially work with multiple keys.

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

No branches or pull requests

2 participants