nervosnetwork / nervosnetwork/ckb

There will be problems with rich-indexer using last_cursor to iterate data

Open
#4,674 2 comments 0 reactions 0 assignees View on GitHub
stale t:bug
Dominant language
Rust
Stars
1.2k
Forks
266
Avg merge
10d 5h
Merged PRs (30d)
4

Description

## Bug Report

### Current Behavior

There will be problems with rich-indexer using last_cursor to iterate data

- Use the get_transactions interface to query and return the situation of lost transactions
image

![image](https://github.com/user-attachments/assets/8682c090-75c2-4e88-9216-de9215ef7f50)

- The cursor of the query will be stuck, resulting in an infinite loop that will not be updated.
```
echo '{
"id": 2,
"jsonrpc": "2.0",
"method": "get_transactions",
"params": [
{
"script": {
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type",
"args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223"
},
"script_type": "lock"
},
"asc",
"0x1","0xf6cb2b010000000001000000"
]
}' | tr -d '\n' | curl -H 'content-type: application/json' -d @- http://16.162.99.28:4118/
{"jsonrpc":"2.0","result":{"last_cursor":"0xf6cb2b010000000001000000","objects":[{"block_number":"0x5b0671","io_index":"0x0","io_type":"input","tx_hash":"0x8205b2b4cd6380d7e332c7a5b49bf776a0322ba19f46dc6ca1f8c59f7daee08d","tx_index":"0x1"}]},"id":2}%
```

### Expected Behavior

Iterative query works fine

### Environment

- **CKB version**: ckb 0.119.0-pre (28fd446 2024-10-08)
- **Chain**: testnet
- **Operating system**: Ubuntu 20.04
- **Arch**: Linux test-new-02 6.8.0-1015-aws #16~22.04.1-Ubuntu SMP Mon Aug 19 19:38:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
- **Installation**: Built from source

### Additional context/Screenshots

[message.txt](https://github.com/user-attachments/files/17340196/message.txt)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided get_transactions request against rich-indexer and compare the returned last_cursor across repeated iterations. Trace why the cursor remains unchanged; done means iterative queries advance the cursor and return all expected transactions without an infinite loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.