Skip to content

refactor(mining): unify block template naming - #701

Open
illuzen wants to merge 1 commit into
mainfrom
refactor/mining-template-naming
Open

refactor(mining): unify block template naming#701
illuzen wants to merge 1 commit into
mainfrom
refactor/mining-template-naming

Conversation

@illuzen

@illuzen illuzen commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

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 bare Version type 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:

  • MiningBuildBlockTemplate
  • VersionTemplateVersion, VersionSignalTemplateVersionSignal
  • MiningHandle::version()template_version()
  • wait_for_version_change()wait_for_template_change()
  • on_build()on_new_template(), create_proposal()create_block_template()
  • pending_buildpending_rebuild (it holds a rebuild request hash, not a build)
  • comments/logs saying "build"/"candidate" now say "template"

"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

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>
@illuzen
illuzen force-pushed the refactor/mining-template-naming branch from a19db21 to 04f2daa Compare September 12, 2026 08:34

@n13 n13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --check and locked Cargo metadata — passed.
  • taplo format --check --config taplo.toml and scripts/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 n13 removed the bot-review label Sep 12, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not reviewing again — no new commit or comment since the last review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants