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

Store: Support Direct SS Writes #18467

Open
Tracked by #17041
alexanderbez opened this issue Nov 14, 2023 · 11 comments
Open
Tracked by #17041

Store: Support Direct SS Writes #18467

alexanderbez opened this issue Nov 14, 2023 · 11 comments
Assignees
Labels

Comments

@alexanderbez
Copy link
Contributor

alexanderbez commented Nov 14, 2023

Context

In the original store v2 ADR, we proposed functionality for modules to have the ability to directly write and read state that is outside of commitment, e.g. CW metadata or large blobs of data.

Proposal

We can easily support this by adding two APIs to the existing types:

type RootStore interface {
  // ...

  GetVersionedDatabase() VersionedDatabase
}

type VersionedDatabase interface {
  // ...

  Set(storeKey string, version uint64, key, value []byte) error
}
@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Nov 14, 2023
@alexanderbez alexanderbez added C:Store and removed needs-triage Issue that needs to be triaged labels Nov 14, 2023
@tac0turtle
Copy link
Member

what about a non consensus set, or MetadataSet that is documented to be outside of consensus? apps will be able to get the data per usual but there isnt a need to expose the version database interface to everything?

@alexanderbez
Copy link
Contributor Author

Yes, this is what I'm alluding to. Allowing SS (VersionedDatabase) to directly store non-consensus data.

@tac0turtle
Copy link
Member

ah, it looked like you were exposing the version database at the root level, which is why it was confusing. I dont think we should expose that level of detail, feels like a code smell

@alexanderbez
Copy link
Contributor Author

alexanderbez commented Nov 15, 2023

Yes, of course. What I'd like is for the ability for modules to get direct access to the SS backend so they can call Set(...) and Get(...).

@tac0turtle tac0turtle changed the title Support Direct SS Sets Store: Support Direct SS Sets Nov 17, 2023
@alexanderbez alexanderbez changed the title Store: Support Direct SS Sets Store: Support Direct SS Writes Dec 13, 2023
@tac0turtle
Copy link
Member

is this still blocked?

@alexanderbez
Copy link
Contributor Author

I would say it's blocked until we have a complete picture of server/v2 store/v2 integration. Is that complete? If so, we can discuss the following:

  1. How do we allow modules to get direct access to SS s.t. it doesn't interfere with consensus state keys
  2. How do we cleanly support snapshotting extensions

@tac0turtle
Copy link
Member

this will be part of runtime/v2

@alexanderbez
Copy link
Contributor Author

Once the design is settled, please let me know so I can document it in the store/v2 docs.

@tac0turtle
Copy link
Member

should we make a service like we do kvstoreServices?

@alexanderbez
Copy link
Contributor Author

Once the design is settled, please let me know so I can document it in the store/v2 docs.

Yes, that's what I had envisioned more or less. So a module would have as input Environment and from Environment it can say:

ncStore := env.GetNonConsensusStore(...) // I presume this is already scoped to the module's store key???
ncStore.Set(key, val)

One thing I've realizing is that we may need to handle rollbacks. E.g. if a module writes to non-consensus state during say a tx, but that tx later fails, should we roll it back?

@alexanderbez
Copy link
Contributor Author

ref: #19721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

2 participants