-
Notifications
You must be signed in to change notification settings - Fork 103
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
Off-chain, local store for ORM module state (managed by the state machine) #304
Comments
Not a bad idea, but obviously lots of details to be worked out. How much does this overlap with the caching work Ian has been working on? Would we use a kv-store or why not just sqlite? Would these queries be available within the consensus layer or not? (In ADR 033, queries become available to other modules in the consensus layer) |
This could be complementary to Ian work. The difference is in: who is in charge of a supplementary KV store:
That would depend on the module. I think for |
Talked briefly with Robert about this, the concern I brought up is around state sync. If you plan on allowing state sync you will need to chuck this data as well, otherwise the app is non-deterministic. This can be done but has some trade offs. How would this differ from using an oracle module for when the data is needed? |
Yes, this will need integration with state sync.
Oracle is not managed by a state machine. This proposal is a mechanism for a support DB controlled by the state machine. |
Any further discussion around this should move to the sdk. It looks like related discussions are happening in the following: |
Is your feature request related to a problem? Please describe.
The ORM package (
/orm
) is used to provide other modules with index related records (eg a sequence of integers for new record ids). Building indexing features are not needed for consensus. We don't need to store the latest ID / sequence number in a state storage.Storing things in the state machine state has a performance and storage overhead: it has to be organized in the state consensus data structure (merkle tree) which is much slower. Also adding more stuff there impacts the performance of the chain.
Describe the solution you'd like
We can use an off-chain, in process helper DB (goleveldb, berkeleyDB....) to store support data (eg the latest sequence number).
This won't decrease the security of the blockchain, nor impact the consensus: the transaction generated records, with proper IDs, will continue to be stored in the state tree. So the proper values will still be verified by the consensus.
Additional context
Updating the orm to use a helper DB (eg goleveldb) is rather straightforward. We can use the current
tm-db
interface or picking one KV store and use it.The problem is with with node sync: both by importing a chain dump, or using fast sync. Currently, only chain data is exported. So we would need to add
orm
off-chain state to genesis and to the fast sync.The text was updated successfully, but these errors were encountered: