Repository navigation
Clarify mining logs: real job-stop reasons and per-type worker numbering - #108
Merged
Merged
Conversation
Miners were confused by "cancelled" logs when a new block arrived, and
by mismatched numbering between service workers and engine devices
("GPU worker 5" vs "GPU 0").
- Track why a job stopped (JobStopReason: new block, solution found,
connection lost) in WorkerPool and log it in worker completion lines,
e.g. "GPU worker 0 stopped (new block received): ..."
- Rename WorkerPool::cancel() to stop_current_job(reason)
- Number workers per engine type (CPU 0..N, GPU 0..M) instead of one
global counter; rename WorkerResult.thread_id to worker_id
- Engine logs now say "GPU device N" / "CUDA device N" to distinguish
hardware from worker threads
- Reword job lifecycle logs: new job arrival is "🧱 New block to mine",
solution submission is "✅ Job N solved ... submitting solution"
- Demote wgpu engine's per-cancellation info log to debug; the service
now emits the clear info-level line with the actual reason
No mining behavior changes; log text, log levels, and internal renames
only.
Co-authored-by: Cursor <cursoragent@cursor.com>
n13
approved these changes
Sep 17, 2026
n13
left a comment
Contributor
There was a problem hiding this comment.
Reviewer model: GPT 5.6 Sol
APPROVE — no blocking findings.
The stop reason is stored before each job-generation change, every stop site supplies the appropriate reason, and the per-engine worker numbering is carried consistently through worker results and stale-result logs. The engine changes are limited to log wording and log level.
Validation:
taplo format --check --config taplo.toml— passedcargo +nightly fmt --all -- --check— passedcargo test --workspace --locked— passed (67 tests)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings— passed- GitHub CI — all six checks passed at
a2007f4928ef48935f2d7bfdb51f48e1d3393af4
The PR's documented rapid-successive-stop race can still make the displayed stop reason stale, but it does not affect cancellation or mining behavior and is not blocking for this logging-focused change.
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Miners (especially newcomers) were confused by "job cancelled" logs — which almost always just mean a new block arrived — and by inconsistent numbering where the same GPU appeared as "GPU worker 5" in service logs but "GPU 0" in engine logs.
What changed
miner-service
WorkerPoolnow records why a job stopped via a newJobStopReasonenum (NewBlock,SolutionFound,ConnectionLost), so worker completion lines state the actual reason instead of assuming "new block" for every stop:CPU worker 2 stopped (new block received): 2170000 hashes in 4.90s (442.83 KH/s)GPU worker 0 stopped (solution already found): ...CPU worker 1 stopped (node connection lost): ...CPU worker 3 finished (nonce range exhausted): ...WorkerPool::cancel()→stop_current_job(reason).WorkerResult.thread_id→worker_id.🧱 New block to mine: job 1393 (header 0x...); solution submission is✅ Job 1393 solved: ... - submitting solution to node. Renamedresult_sent_for_current_job→solution_submitted_for_current_job.engine-gpu / engine-cuda
GPU device N/CUDA device N(instead of bareGPU N) to distinguish hardware from worker threads.GPU 0 cancelled before batch 5) is reworded toGPU device 0 search stopped after 5 batchesand demoted to debug — the service now emits the clear info-level line with the actual stop reason.No mining behavior changes: log text, log levels, and internal renames only. Engine-level
EngineStatus::Cancelled/CancelCheckAPIs are intentionally unchanged (accurate mechanical terms shared across engine crates and benchmarks).Validation
./clippy.sh(taplo fmt + cargo fmt + clippy-D warnings): cleancargo test --workspace --locked: 67 tests pass, 0 failuresRisks and mitigations
JobStopReasonis read by workers after they observe a job-ID change; a tiny race could log a stale reason if two stops happen back-to-back. Log-text-only impact, no functional risk.Worker thread assigned to GPU device Ninfo line shows the mapping.Follow-ups
None.
Made with Cursor