Add ckb test skills - #115
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new Cursor “ckb-test” skill and accompanying reference documentation intended to describe the Python integration test framework in this repo and a Rust integration test framework (described as ckb/test/).
Changes:
- Added
.cursor/skills/ckb-test/SKILL.mdto describe testing domains, repo layout, and common patterns. - Added Python framework architecture reference doc under
.cursor/skills/ckb-test/references/. - Added Rust test framework reference doc under
.cursor/skills/ckb-test/references/.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
.cursor/skills/ckb-test/SKILL.md |
New skill overview, directory map, and reference links for CKB testing. |
.cursor/skills/ckb-test/references/framework-architecture.md |
New reference describing Python framework components (CkbNode, RPCClient, helpers). |
.cursor/skills/ckb-test/references/rust-test-framework.md |
New reference describing a Rust-based integration test framework and runner model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| client.dry_run_transaction(tx) | ||
| client.get_live_cell(out_point, with_data=True) | ||
| client.get_consensus() | ||
| client.get_fee_rate_statistics(target=None) |
There was a problem hiding this comment.
The RPCClient method name here is listed as get_fee_rate_statistics, but the current implementation is get_fee_rate_statics (no matches for get_fee_rate_statistics in framework/). Update the documentation to the correct method name (or rename the implementation, but that’s outside this PR).
| client.get_fee_rate_statistics(target=None) | |
| client.get_fee_rate_statics(target=None) |
| 3. Filter specs by name pattern | ||
| 4. Spawn N worker threads | ||
| 5. Each worker pulls specs from shared queue | ||
| 6. Workers report results via channels (`Notify::Start/Done/Error/Panick`) |
There was a problem hiding this comment.
Typo in event name: Panick should be Panic (or whatever the actual enum variant is). As written, it reads like a misspelling and makes it harder to search/grep the code.
| 6. Workers report results via channels (`Notify::Start/Done/Error/Panick`) | |
| 6. Workers report results via channels (`Notify::Start/Done/Error/Panic`) |
|
|
||
| ## Overview | ||
|
|
||
| Located at `ckb/test/`, the Rust test framework provides lower-level testing with P2P protocol simulation. Tests run against real CKB node processes with fine-grained control over block construction, network messages, and chain state. |
There was a problem hiding this comment.
This document describes a Rust test framework located at ckb/test/, but there is no ckb/ directory in this repository. Consider adding a pointer to where that framework actually lives (e.g., upstream CKB repo) or when/how it is obtained, to avoid implying it’s part of this codebase.
| Located at `ckb/test/`, the Rust test framework provides lower-level testing with P2P protocol simulation. Tests run against real CKB node processes with fine-grained control over block construction, network messages, and chain state. | |
| In the upstream CKB repository (https://github.com/nervosnetwork/ckb), the Rust test framework lives under the `test/` directory and provides lower-level testing with P2P protocol simulation. Tests run against real CKB node processes with fine-grained control over block construction, network messages, and chain state. This framework is referenced by, but not contained in, this repository. |
| --- | ||
| name: ckb-test | ||
| description: Comprehensive CKB blockchain integration test skill covering both Python (pytest) and Rust test frameworks. Use when writing, reviewing, debugging, or extending CKB integration tests, transaction pool tests, RPC tests, mining tests, P2P sync tests, DAO tests, hardfork tests, contract tests, or any CKB node behavior tests. Also use when asked about CKB testing patterns, framework architecture, or Bitcoin Core design parallels in the CKB context. | ||
| --- |
There was a problem hiding this comment.
PR title indicates updating CKB to 0.204.0 and macOS support to 15, but the diff only adds Cursor skill/reference markdown files. If the version/macOS changes are in another PR, consider retitling this PR; otherwise the actual upgrade changes appear to be missing from this PR.
| 1. **Python integration tests** (`test_cases/`) -- high-level end-to-end tests using pytest | ||
| 2. **Rust integration tests** (`ckb/test/`) -- lower-level node behavior tests with P2P simulation | ||
|
|
||
| Both mirror Bitcoin Core's functional test design: spawn real node processes, interact via RPC, verify blockchain state. |
There was a problem hiding this comment.
This skill doc claims the repo contains Rust integration tests under ckb/test/, but there is no ckb/ directory in this repository. Consider clarifying that the Rust framework lives in the upstream CKB repo (or is fetched/generated during make prepare) to avoid misleading readers.
| 1. **Python integration tests** (`test_cases/`) -- high-level end-to-end tests using pytest | |
| 2. **Rust integration tests** (`ckb/test/`) -- lower-level node behavior tests with P2P simulation | |
| Both mirror Bitcoin Core's functional test design: spawn real node processes, interact via RPC, verify blockchain state. | |
| 1. **Python integration tests** (`test_cases/` in this repo) -- high-level end-to-end tests using pytest | |
| 2. **Rust integration tests** (in the upstream CKB repo, e.g. under `test/`, typically fetched/prepared via `make prepare`) -- lower-level node behavior tests with P2P simulation | |
| Both test layers mirror Bitcoin Core's functional test design: spawn real node processes, interact via RPC, verify blockchain state. |
| ## Additional References | ||
|
|
||
| - **Framework architecture**: [references/framework-architecture.md](references/framework-architecture.md) | ||
| - **Common test patterns**: [references/test-patterns.md](references/test-patterns.md) | ||
| - **Rust test framework**: [references/rust-test-framework.md](references/rust-test-framework.md) | ||
| - **Bitcoin Core comparison**: [references/bitcoin-core-comparison.md](references/bitcoin-core-comparison.md) |
There was a problem hiding this comment.
The "Additional References" section links to references/test-patterns.md and references/bitcoin-core-comparison.md, but those files are not present under .cursor/skills/ckb-test/references/. Add the missing reference files or remove/update the links so they don’t 404.
| client = node.getClient() | ||
|
|
||
| # Chain RPCs | ||
| client.get_tip_block_number() # Returns hex string |
There was a problem hiding this comment.
Doc says client.get_tip_block_number() returns a hex string, but in framework/rpc.py it returns an int (it converts from hex via int(..., 16)). Update this return type note to match actual behavior, otherwise test authors may double-convert or compare against the wrong type.
| client.get_tip_block_number() # Returns hex string | |
| client.get_tip_block_number() # Returns int block number |
No description provided.