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

memiavl state-synced node cannot be used as JSON-RPC node

Open
#1,146 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
336
Forks
299
Avg merge
2d 17h
Merged PRs (30d)
4

Description

**Describe the bug**
memiavl state-synced node cannot be used as JSON-RPC node. Same result for node using `enable-indexer = true`

Another node that was traditionally state-synced with memiavl enabled provided the snapshot.

**To Reproduce**

- Traditional statesync with memiavl and versiondb enabled by adding following to `app.toml`
- Should get a snapshot when synced
```
[memiavl]

# Enable defines if the memiavl should be enabled.
enable = true

# ZeroCopy defines if the memiavl should return slices pointing to mmap-ed buffers directly (zero-copy),
# the zero-copied slices must not be retained beyond current block's execution.
zero-copy = false

# AsyncCommitBuffer defines the size of asynchronous commit queue, this greatly improve block catching-up
# performance, -1 means synchronous commit.
async-commit-buffer = 0

# SnapshotKeepRecent defines what many old snapshots (excluding the latest one) to keep after new snapshots are taken.
snapshot-keep-recent = 2

# SnapshotInterval defines the block interval the memiavl snapshot is taken, default to 1000.
snapshot-interval = 1000

# CacheSize defines the size of the cache for each memiavl store, default to 1000.
cache-size = 1000

[store]
streamers = ["versiondb"]
```
- Export memiavl snapshot with `cronosd snapshots dump 9911000 2`
- Copied the `9911000-2.tar.gz` file into another server
- Import snapshot with `cronosd snapshots load 9911000-2.tar.gz`
- Restore snapshot using `cronosd snapshots restore 9911000 2`
- Bootstrap with `cronosd tendermint bootstrap bootstrap-state`
- Start cronosd with `cronosd start`. Node starts syncing
- Send `eth_call` to JSON-RPC port `curl localhost:18454 -X POST -H "Content-Type: application/json" --data '{"method":"eth_call","params":[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "latest"],"id":1,"jsonrpc":"2.0"}'`
- Get reply of `{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"rpc error: code = Unknown desc = rpc error: code = Internal desc = failed to obtain coinbase address: failed to retrieve validator from block proposer address crcvalcons1gulrn5tyrjhrs39gxnnfmp52y8duentwdf4shu: validator does not exist: unknown request"}}`

**Expected behavior**
On another node with almost exact same `app.toml` and `config.toml` except for the memiavl and versiondb, got reply of `{"jsonrpc":"2.0","id":1,"result":"0x"}`

**Desktop (please complete the following information):**
- Linux v1.0.12

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using the listed memiavl and versiondb settings, snapshot commands, and eth_call request. Start by tracing the JSON-RPC path that reports “failed to obtain coinbase address” and comparing it with a node without memiavl/versiondb. Done means a state-synced node serves the eth_call successfully and returns the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.