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

Problem: don't support distributed state query service #725

Open
1 task
yihuang opened this issue Sep 28, 2022 · 3 comments
Open
1 task

Problem: don't support distributed state query service #725

yihuang opened this issue Sep 28, 2022 · 3 comments
Assignees

Comments

@yihuang
Copy link
Collaborator

yihuang commented Sep 28, 2022

Currently to provide distributed public json-rpc service, one need to run multiple full nodes, each node sync the chain directly.
With the help of recent new features, it's possible to replicate the chain state directly and setup cheaper distributed query service.

  • cosmos-sdk already support state streaming1, but there's only a file based implementation builtin.
  • cosmos-sdk already support --grpc-only mode.
  • we are implementing another streaming service which save the historical states in a db2, and eventually will use this db to support the grpc query server.

We just need one more piece to complete the puzzle: replicate the state stream across multiple processes.

Implementation ideas:

  • based on the builtin file streamer
    • do we need to keep the abci begin/end headers?
    • do we keep the insertion order, or merge the writes? The insertion order enables consumer to reconstruct the iavl tree.
    • one file per block which is easier for client to sync?
    • Is millions of files under single directory is too much? could separate directories based on parts of digits in block number.
  • open a http server to serve these files.
  • start client node in --grpc-only mode, and sync the stream files in the order of block numbers, feed them to the version db2.
  • Problem: client logic for syncing state stream is not implemented #732

Future Works

grpc service alone is not very interesting in the context of cronos, json-rpc is more important, for json-rpc service to work, we also need to sync the tendermint dbs(mainly the raw blocks and tx execution results).

Footnotes

  1. https://docs.cosmos.network/master/architecture/adr-038-state-listening.html

  2. Problem: there's no compact historical state storage #704 2

@yihuang
Copy link
Collaborator Author

yihuang commented Sep 28, 2022

open a http server to serve these files.

probably ok to ask user to setup a third-party http server for this, after all, we are talking about setting up distributed service here.

@JayT106
Copy link
Collaborator

JayT106 commented Oct 18, 2022

how do we know the result of the state query from the untrusted party is correct? How do we verify it?

@yihuang
Copy link
Collaborator Author

yihuang commented Oct 19, 2022

how do we know the result of the state query from the untrusted party is correct? How do we verify it?

it's only for trusted parties, like the public rpc services.

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

3 participants