-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
docs(adr): update ADR-40 by adding low level access to SC #9451
Conversation
State sync snapshots will still need to send the contents of the external state and derive the commitment structure from it, right? We may want some way to register a namespace as a "sub-store", and let the module specify how it is serialized. |
@roysc - I think it's better that stat sync works on DB level: it sends DB data (not structures) over the wire. So we have 2 DBs to sync: |
That should work fine, but the bootstrapping node will need to rebuild the state commitment store once the DB contents are synced. When it does this, it needs to exclude the records in the module's namespace; then the module needs to rebuild its custom SC store from those records. So what I mean to say is, the module needs to specify how its data is deserialized, and the root store needs to be aware of what namespaces to exclude from its SC data. |
The only thing we need to rebuild |
I was going off this comment: #8430 (comment). I believe either way should work, no? the SC data could be derived from SS, or sent in a snapshot - it's just a tradeoff of computing time vs. bandwidth, I don't have any context to know which we'd rather optimize. My main question here is, if the module is storing an "external" object, how does it get sent during state sync, if at all? |
You are right @roysc , initially we didn't plan to expose writing to |
@robert-zaremba I would overall prefer not exposing SC unless there's a good use case, to keep the design from becoming too complicated. It depends on how important the external-storage/custom-SC feature is. If it's just "nice to have", there should not be anything design-wise that would block this from being added in the future. It would mainly be a matter of supporting the proof format and defining a way to make the root store "aware" of the external data. |
We have already use-cases where we will just like to hook to the |
After thinking more about it I'm more leaning towards not messing up with the internals. If the low level access will be used only to save few kb of data, then we can easily duplicate it and save normally (so both in SC and SS). |
This is not just or even mostly about performance. It is about exposing a proof format that is logical for client using a higher level API like the orm. Also it is for allowing other state systems to hook into the proof system. In this case the overhead of storing twice may be small if it's just a hash, I'm not sure. But for the orm use case I think the ability for storing different data in SC vs SS could greatly improve the client developer UX. |
The key question is what we will save in SC which won't be saved in SS? If it's only few records per module then it's not worth. If a module will use it's own storage, then the module will save the commitment to that store, unless that store will not have a succinct and efficient commitment. Example that we have been chatting about is a module with it's own SQL DB and will like to commit to all values individually. However I still wonder if it would make more sense to create another, module level |
For the ORM approach I think it will be every record which would be inefficient.
I'm imagining that in the future an ORM/Object Store approach will be the default. So I think we should consider this a first class use case. Storing just a root would make proofs harder at the client level, no? Anyway, maybe let's sync up on a call. |
@robert-zaremba I described the ORM use case in more detail here: #9156 (comment). Maybe |
Do we need to define here how the low level access will be exposed? I was thinking about the accessor method. |
As discussed on a call, having |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs more discussion and a design consensus. Having considered it, I agree with @aaronc that store keys would be the best access design for this. Let's evaluate if that would satisfy the need use cases.
@robert-zaremba can you address roy's comments. Lets please please get this merged. |
0d73d68
to
ba63cc3
Compare
@aaronc The current proposal doesn't give direct access to all modules. The module will still receive a store key. But instead of receiving 3 store keys, it will get one and will use it with KVStore, SSStore or SCStore in order to access the right namespace. |
I'm fine with some sort of multistore interface that allows access to different store types (including memory and transient and other types which may arise) with a single key. That's actually beneficial for the ORM. But it doesn't belong in I think we need a larger conversation about the specific ideal store key design for the ORM's use case. And ultimately I think we need this multistore design to support both IAVL and SMT. Let's find a time to unpack this more soon. |
closing this as its been open for a year+ |
Description
When reviewing ADR-40 we were discussion about a use-case for modules to commit to an external value without engaging a state store. This proposal extends the ADR-40 describing such access.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes