crypto-org-chain / crypto-org-chain/cronos

Problem: don't support distributed state query service

Open
#725 3 comments 1 reaction 1 assignee Claimed by @mmsqe View on GitHub
Dominant language
Go
Stars
336
Forks
299
Avg merge
2d 17h
Merged PRs (30d)
4

Description

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 streaming[^1], 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 db[^2], 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 db[^2].
- [x] https://github.com/crypto-org-chain/cronos/issues/732

## [Future Works](#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).

[^1]: https://docs.cosmos.network/master/architecture/adr-038-state-listening.html
[^2]: #704

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.