nervosnetwork / nervosnetwork/neuron
Show CKB data-migration progress and logs in the UI (currently only a static "migrating..." indicator)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 204
- Forks
- 95
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 4
Description
Feature Request
Is your feature request related to a problem?
When the bundled CKB node requires a data migration on startup (e.g. after upgrading to a ckb release with a new DB schema), Neuron shows a static migrating... indicator in the top-right sync-status area for the entire duration. The confirmation dialog estimates 20 ~ 60 min, and during that whole window the user gets no feedback at all — no percentage, no current step, no log output. It is impossible to tell whether the migration is progressing or stuck, which is likely to generate "is my wallet broken?" support reports.
Current behavior
migrateCkbData()spawnsckb migrate -C <nodeDataPath> --forcewithstdio: ['ignore', 'pipe', 'pipe'], but stderr is only written to electron-log and the last chunk is kept as a failure reason. Nothing is forwarded to the renderer:packages/neuron-wallet/src/services/ckb-runner.ts(migrateCkbData, ~L195–218)
- Migration state has only 4 discrete states —
need-migrate | migrating | finish | failed— with no progress payload:packages/neuron-wallet/src/models/subjects/migrate-subject.ts- forwarded over the
migratechannel inpackages/neuron-wallet/src/controllers/app/subscribe.ts
- The UI replaces the sync status with the static
network-status.migratingtext:packages/neuron-ui/src/components/SyncStatus/index.tsx(~L119)
What CKB exposes during migration
- Migration progress bars are rendered by
indicatifto the child process's stderr (nervosnetwork/ckb,db-migration/src/lib.rs,ProgressDrawTarget::stderr()), including processed/total counts - Info-level migration log lines (e.g.
start to run migrate in background: ...) go to both the standard streams and the rotating log file under the node data dir (ckb.tomldefaults:log_to_file = true,log_to_stdout = true, filter =info) - During a foreground migration no RPC is available, so parsing the child process output is the only viable channel
Proposed solution
Since Neuron already pipes both streams of the ckb migrate child process, the data is already in our hands — it just stops at the main process:
- Parse the
indicatifprogress output (or, as a minimal first step, just the info-level migration log lines) from stderr inmigrateCkbData(). Note the progress bars redraw the same line with ANSI control sequences, so the parser needs to strip those before extractingprocessed/total. - Extend
MigrateSubjectmessages with aprogresspayload (e.g.{ processed, total, percent }and/or the latest log line) and forward it over the existingmigrateIPC channel. - In the UI, render the percentage in place of the static
migrating...text (e.g.Migrating 42%), optionally with a tooltip / expandable detail view showing the live migration log tail — the same pattern as the existing sync-status tooltip, which already showscacheTip / bestKnownblock numbers and estimated time left (packages/neuron-ui/src/components/SyncStatus/index.tsx,SyncDetail).
Additional context
- The current flow was built for the v0.35.1 bundled-node data migration; the dialog copy (
messages.rebuild-sync) still says "estimated 20 ~ 60min" - Related history: #3321 (feat: Optimize data migration), #2869 (fix: Show the migrate ckb data dialog)
- CKB also supports running some migrations in the background (
run_in_background); if that path is ever used, node RPC stays up and progress could be surfaced differently — worth keeping the abstraction in mind
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with migrateCkbData() in packages/neuron-wallet/src/services/ckb-runner.ts and inspect MigrateSubject plus the migrate forwarding in packages/neuron-wallet/src/controllers/app/subscribe.ts. Then read packages/neuron-ui/src/components/SyncStatus/index.tsx and SyncDetail; done means migration progress or logs reach the UI instead of only the static migrating... indicator.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- backend, blockchain, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100