refactor(mining): unify block template naming - #701
Conversation
Standardize on "template" for the candidate block being mined, which was variously called build, template, candidate, and proposal: - MiningBuild -> BlockTemplate - Version -> TemplateVersion, VersionSignal -> TemplateVersionSignal - MiningHandle::version() -> template_version() - wait_for_version_change() -> wait_for_template_change() - on_build() -> on_new_template(), create_proposal() -> create_block_template() - pending_build -> pending_rebuild (it holds a rebuild request, not a build) "Job" remains the external-miner wire concept. No behavior changes. Co-authored-by: Cursor <cursoragent@cursor.com>
a19db21 to
04f2daa
Compare
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6 Astra
APPROVE — no blocking findings.
Reviewed the complete three-file diff at 04f2daa11c58cebc010bac6227e4e365cc33e219 against 662ef6d1dea8f3572776b8db9da1f57283744fd2. The template/type/method renames are consistent across construction, cloning, submission, and both mining paths. Template generation tracking, cancellation, lock boundaries, seal verification, and the external-miner wire protocol retain their behavior.
Validation:
git diff --checkand locked Cargo metadata — passed.taplo format --check --config taplo.tomlandscripts/fmt.sh --all -- --check— passed.SKIP_WASM_BUILD=1 cargo test --locked -p sc-consensus-qpow— 13 passed, including retained notifications, multiple waiters, and cancellation.SKIP_WASM_BUILD=1 cargo test --locked -p quantus-node --bin quantus-node— 62 passed, including cancellation of result reception.SKIP_WASM_BUILD=1 cargo clippy --locked -p sc-consensus-qpow -p quantus-node --all-targets -- -D warnings— passed.SKIP_WASM_BUILD=1 RUSTDOCFLAGS='-D warnings' cargo doc --locked --no-deps -p sc-consensus-qpow -p quantus-node— passed.
The tests and formatting checks ran before the rebase at a19db21b; I verified that its Git tree is identical to the current head (9f7bdcc4b5b3259bac19ce2f1076f952940f4af9). Clippy and rustdoc ran at the current head. Full Linux/macOS CI and CI analysis were still running at review time.
n13
left a comment
There was a problem hiding this comment.
Not reviewing again — no new commit or comment since the last review.
Problem
The candidate block being mined is referred to by four different names across the mining code:
MiningBuild/"build" in code, "block template" and "candidate" in comments and logs, and "proposal" via the inner Substrate type. On top of that, the bareVersiontype doesn't say what it is a version of (it tracks template generations, not software versions).Change
Standardize on template as the canonical noun, matching standard PoW terminology:
MiningBuild→BlockTemplateVersion→TemplateVersion,VersionSignal→TemplateVersionSignalMiningHandle::version()→template_version()wait_for_version_change()→wait_for_template_change()on_build()→on_new_template(),create_proposal()→create_block_template()pending_build→pending_rebuild(it holds a rebuild request hash, not a build)"Job" is intentionally unchanged in
miner_server.rs— it is a distinct concept (the wire-protocol message broadcast to external miners).Pure rename on top of #700; no behavior changes.
Validation
SKIP_WASM_BUILD=1 cargo test -p sc-consensus-qpow: 13 passedSKIP_WASM_BUILD=1 cargo test -p quantus-node --bin quantus-node: 62 passed./clippy.shcleangit diffempty)