Skip to content

dash(S8): get_work() consumer capstone — fuse NodeCoinState::select_work() + assemble_work_job_targets() - #698

Merged
frstrtr merged 1 commit into
masterfrom
dash/s8-getwork-consumer-capstone
Jul 14, 2026
Merged

dash(S8): get_work() consumer capstone — fuse NodeCoinState::select_work() + assemble_work_job_targets()#698
frstrtr merged 1 commit into
masterfrom
dash/s8-getwork-consumer-capstone

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Re-land of #695 (closed as a side-effect of its base #694 merging, not rejected). Rebased clean onto current master @7115c976.

Fuses the two landed S8 halves via a single stratum entry point src/impl/dash/stratum/get_work.hpp:

  • NodeCoinState::select_work() — embedded template source, dashd getblocktemplate fallback ALWAYS retained (safety + [GBT-XCHECK] arm).
  • assemble_work_job_targets() — get_work() job-target arithmetic (oracle: frstrtr/p2pool-dash, older-than-v35).

SAFE-ADDITIVE, single-coin (src/impl/dash/ only). +337/-2. New header + KAT; build.yml both --target allowlists updated.

Verify (Linux x86_64): cmake --build build --target test_dash_get_work → RC=0; ctest -R DashGetWork → 4/4 passed (populated→embedded, gap→fallback, job-targets ride either source, invalidate→demote).

NEXT S8 gap after this lands: no run-path caller — node.cpp has no stratum accept loop that invokes stratum::get_work(). That stratum SERVER slice is the follow-on.

Requesting integrator diff + full-CI verify (no false-green), then operator tap.

…work() template source + assemble_work_job_targets()

The embedded get_work chain was fully wired but had NO production consumer:
NodeCoinState::select_work() (embedded template when the 4-leg reception wire
(#693/#694) has populated the node bundle, else the retained dashd
getblocktemplate fallback) and assemble_work_job_targets() (per-miner job-target
arithmetic) each existed and were unit-tested, but nothing fused them into a
single miner-facing entry. Only the test suites ever called select_work().

Add dash::stratum::get_work() (src/impl/dash/stratum/get_work.hpp): the first
non-test caller of the embedded arm. It sources the base block template off the
node-held NodeCoinState -- NO direct dashd poll on the hot path when the bundle
is populated -- and assembles the job targets over whichever template arm ran.
dashd_fallback stays REQUIRED and is invoked ONLY on a set-gap (unpopulated /
invalidated bundle): the always-reachable safety + [GBT-XCHECK] cross-check arm,
never removed.

test_dash_get_work (4/4) pins the fused contract, seeding mirrored exactly from
test_dash_node_embedded_wire (no fabricated oracle values):
  * set-gap routes DashdFallback (invoked once) and still assembles targets;
  * populated routes Embedded WITHOUT invoking the fallback, byte-equal to a
    direct build_embedded_workdata() over the node's own held state;
  * job targets are identical across both template sources;
  * on_invalidate (reorg) demotes back to the fallback.

Registered in both build.yml --target allowlists. STRICTLY single-coin
(src/impl/dash/ + test only), SAFE-ADDITIVE.
@frstrtr
frstrtr merged commit 3f261dd into master Jul 14, 2026
26 checks passed
frstrtr added a commit that referenced this pull request Jul 14, 2026
4a skeleton mirroring dgb::stratum::DGBWorkSource: concrete
core::stratum::IWorkSource for DASH (X11). Declares the fused
get_work() member the get_work.hpp capstone forward-refs as the
eventual DASHWorkSource::get_work(); holds the node-held coin-state
embedded arm + the always-reachable dashd GBT RPC fallback (never
removed -- safety/[GBT-XCHECK]). All work-gen/submit methods are
MVP-default; .cpp bodies + CMake OBJECT wiring + instantiation KAT
land in the follow-on 4b commit once #698 is on master.

Header-only declaration; not yet in any build target (inert). Stacked
on #698 (get_work.hpp); held per integrator until #698 lands to avoid
a stacked-PR auto-close.
frstrtr added a commit that referenced this pull request Jul 14, 2026
Stage 4b for the DASHWorkSource stratum accept-loop seam (follow-on to the
4a header skeleton). Gives the concrete core::stratum::IWorkSource a linkable
definition so it is INSTANTIABLE and holdable via shared_ptr<IWorkSource> by a
future core::StratumServer, before the substantive X11 work-assembly lands.

work_source.cpp (new):
  - constructor binding the NON-OWNING NodeCoinState reference (embedded arm),
    the REQUIRED dashd getblocktemplate fallback closure (GBT-XCHECK safety,
    never removed), and the dual-path won-block submit callback;
  - real bodies: get_best_share_hash_fn / set_best_share_hash_fn (locked),
    has_merged_chain (false, standalone X11), the per-connection worker
    registry (register/update/unregister, idempotent on unknown sessions);
  - fused get_work() adapter over the free dash::stratum::get_work() capstone
    (#698): embedded when the coin-state is populated, retained dashd fallback
    on a set-gap;
  - work-generation / coinbase / mining_submit / compute_share_difficulty held
    at documented SAFE DEFAULTS (empty template, reject, 0.0 sentinel) for
    4c/4d -- mirrors dgb::stratum::DGBWorkSource 4a->4b->4c->4d progression.

dash_stratum OBJECT lib (stratum/CMakeLists.txt + add_subdirectory): SAFE-ADDITIVE,
compiled here, linked only by the KAT now (and c2pool-dash in a later slice), so
ltc/btc/doge/dgb build + ctest surfaces stay untouched. Per-coin isolation held:
src/impl/dash only, dashd RPC fallback preserved.

test_dash_stratum_work_source (new, 11 KATs, Linux x86_64 11/11): construction +
full IWorkSource contract, config defaults, work-generation counter, share-target
atomics, worker registry, best-share callback, 4b safe-default assertions, and the
fused get_work() routing to the retained dashd fallback on an unpopulated
coin-state. Added to BOTH build.yml --target allowlists (NOT_BUILT sentinel guard).
frstrtr added a commit that referenced this pull request Jul 14, 2026
4a skeleton mirroring dgb::stratum::DGBWorkSource: concrete
core::stratum::IWorkSource for DASH (X11). Declares the fused
get_work() member the get_work.hpp capstone forward-refs as the
eventual DASHWorkSource::get_work(); holds the node-held coin-state
embedded arm + the always-reachable dashd GBT RPC fallback (never
removed -- safety/[GBT-XCHECK]). All work-gen/submit methods are
MVP-default; .cpp bodies + CMake OBJECT wiring + instantiation KAT
land in the follow-on 4b commit once #698 is on master.

Header-only declaration; not yet in any build target (inert). Stacked
on #698 (get_work.hpp); held per integrator until #698 lands to avoid
a stacked-PR auto-close.
frstrtr added a commit that referenced this pull request Jul 14, 2026
Stage 4b for the DASHWorkSource stratum accept-loop seam (follow-on to the
4a header skeleton). Gives the concrete core::stratum::IWorkSource a linkable
definition so it is INSTANTIABLE and holdable via shared_ptr<IWorkSource> by a
future core::StratumServer, before the substantive X11 work-assembly lands.

work_source.cpp (new):
  - constructor binding the NON-OWNING NodeCoinState reference (embedded arm),
    the REQUIRED dashd getblocktemplate fallback closure (GBT-XCHECK safety,
    never removed), and the dual-path won-block submit callback;
  - real bodies: get_best_share_hash_fn / set_best_share_hash_fn (locked),
    has_merged_chain (false, standalone X11), the per-connection worker
    registry (register/update/unregister, idempotent on unknown sessions);
  - fused get_work() adapter over the free dash::stratum::get_work() capstone
    (#698): embedded when the coin-state is populated, retained dashd fallback
    on a set-gap;
  - work-generation / coinbase / mining_submit / compute_share_difficulty held
    at documented SAFE DEFAULTS (empty template, reject, 0.0 sentinel) for
    4c/4d -- mirrors dgb::stratum::DGBWorkSource 4a->4b->4c->4d progression.

dash_stratum OBJECT lib (stratum/CMakeLists.txt + add_subdirectory): SAFE-ADDITIVE,
compiled here, linked only by the KAT now (and c2pool-dash in a later slice), so
ltc/btc/doge/dgb build + ctest surfaces stay untouched. Per-coin isolation held:
src/impl/dash only, dashd RPC fallback preserved.

test_dash_stratum_work_source (new, 11 KATs, Linux x86_64 11/11): construction +
full IWorkSource contract, config defaults, work-generation counter, share-target
atomics, worker registry, best-share callback, 4b safe-default assertions, and the
fused get_work() routing to the retained dashd fallback on an unpopulated
coin-state. Added to BOTH build.yml --target allowlists (NOT_BUILT sentinel guard).
frstrtr added a commit that referenced this pull request Jul 15, 2026
4a skeleton mirroring dgb::stratum::DGBWorkSource: concrete
core::stratum::IWorkSource for DASH (X11). Declares the fused
get_work() member the get_work.hpp capstone forward-refs as the
eventual DASHWorkSource::get_work(); holds the node-held coin-state
embedded arm + the always-reachable dashd GBT RPC fallback (never
removed -- safety/[GBT-XCHECK]). All work-gen/submit methods are
MVP-default; .cpp bodies + CMake OBJECT wiring + instantiation KAT
land in the follow-on 4b commit once #698 is on master.

Header-only declaration; not yet in any build target (inert). Stacked
on #698 (get_work.hpp); held per integrator until #698 lands to avoid
a stacked-PR auto-close.
frstrtr added a commit that referenced this pull request Jul 15, 2026
Stage 4b for the DASHWorkSource stratum accept-loop seam (follow-on to the
4a header skeleton). Gives the concrete core::stratum::IWorkSource a linkable
definition so it is INSTANTIABLE and holdable via shared_ptr<IWorkSource> by a
future core::StratumServer, before the substantive X11 work-assembly lands.

work_source.cpp (new):
  - constructor binding the NON-OWNING NodeCoinState reference (embedded arm),
    the REQUIRED dashd getblocktemplate fallback closure (GBT-XCHECK safety,
    never removed), and the dual-path won-block submit callback;
  - real bodies: get_best_share_hash_fn / set_best_share_hash_fn (locked),
    has_merged_chain (false, standalone X11), the per-connection worker
    registry (register/update/unregister, idempotent on unknown sessions);
  - fused get_work() adapter over the free dash::stratum::get_work() capstone
    (#698): embedded when the coin-state is populated, retained dashd fallback
    on a set-gap;
  - work-generation / coinbase / mining_submit / compute_share_difficulty held
    at documented SAFE DEFAULTS (empty template, reject, 0.0 sentinel) for
    4c/4d -- mirrors dgb::stratum::DGBWorkSource 4a->4b->4c->4d progression.

dash_stratum OBJECT lib (stratum/CMakeLists.txt + add_subdirectory): SAFE-ADDITIVE,
compiled here, linked only by the KAT now (and c2pool-dash in a later slice), so
ltc/btc/doge/dgb build + ctest surfaces stay untouched. Per-coin isolation held:
src/impl/dash only, dashd RPC fallback preserved.

test_dash_stratum_work_source (new, 11 KATs, Linux x86_64 11/11): construction +
full IWorkSource contract, config defaults, work-generation counter, share-target
atomics, worker registry, best-share callback, 4b safe-default assertions, and the
fused get_work() routing to the retained dashd fallback on an unpopulated
coin-state. Added to BOTH build.yml --target allowlists (NOT_BUILT sentinel guard).
frstrtr added a commit that referenced this pull request Jul 15, 2026
4a skeleton mirroring dgb::stratum::DGBWorkSource: concrete
core::stratum::IWorkSource for DASH (X11). Declares the fused
get_work() member the get_work.hpp capstone forward-refs as the
eventual DASHWorkSource::get_work(); holds the node-held coin-state
embedded arm + the always-reachable dashd GBT RPC fallback (never
removed -- safety/[GBT-XCHECK]). All work-gen/submit methods are
MVP-default; .cpp bodies + CMake OBJECT wiring + instantiation KAT
land in the follow-on 4b commit once #698 is on master.

Header-only declaration; not yet in any build target (inert). Stacked
on #698 (get_work.hpp); held per integrator until #698 lands to avoid
a stacked-PR auto-close.
frstrtr added a commit that referenced this pull request Jul 15, 2026
Stage 4b for the DASHWorkSource stratum accept-loop seam (follow-on to the
4a header skeleton). Gives the concrete core::stratum::IWorkSource a linkable
definition so it is INSTANTIABLE and holdable via shared_ptr<IWorkSource> by a
future core::StratumServer, before the substantive X11 work-assembly lands.

work_source.cpp (new):
  - constructor binding the NON-OWNING NodeCoinState reference (embedded arm),
    the REQUIRED dashd getblocktemplate fallback closure (GBT-XCHECK safety,
    never removed), and the dual-path won-block submit callback;
  - real bodies: get_best_share_hash_fn / set_best_share_hash_fn (locked),
    has_merged_chain (false, standalone X11), the per-connection worker
    registry (register/update/unregister, idempotent on unknown sessions);
  - fused get_work() adapter over the free dash::stratum::get_work() capstone
    (#698): embedded when the coin-state is populated, retained dashd fallback
    on a set-gap;
  - work-generation / coinbase / mining_submit / compute_share_difficulty held
    at documented SAFE DEFAULTS (empty template, reject, 0.0 sentinel) for
    4c/4d -- mirrors dgb::stratum::DGBWorkSource 4a->4b->4c->4d progression.

dash_stratum OBJECT lib (stratum/CMakeLists.txt + add_subdirectory): SAFE-ADDITIVE,
compiled here, linked only by the KAT now (and c2pool-dash in a later slice), so
ltc/btc/doge/dgb build + ctest surfaces stay untouched. Per-coin isolation held:
src/impl/dash only, dashd RPC fallback preserved.

test_dash_stratum_work_source (new, 11 KATs, Linux x86_64 11/11): construction +
full IWorkSource contract, config defaults, work-generation counter, share-target
atomics, worker registry, best-share callback, 4b safe-default assertions, and the
fused get_work() routing to the retained dashd fallback on an unpopulated
coin-state. Added to BOTH build.yml --target allowlists (NOT_BUILT sentinel guard).
frstrtr added a commit that referenced this pull request Jul 16, 2026
…h_stratum OBJECT lib + KAT (#706)

* dash(S8): DASHWorkSource IWorkSource skeleton (stratum accept-loop seam)

4a skeleton mirroring dgb::stratum::DGBWorkSource: concrete
core::stratum::IWorkSource for DASH (X11). Declares the fused
get_work() member the get_work.hpp capstone forward-refs as the
eventual DASHWorkSource::get_work(); holds the node-held coin-state
embedded arm + the always-reachable dashd GBT RPC fallback (never
removed -- safety/[GBT-XCHECK]). All work-gen/submit methods are
MVP-default; .cpp bodies + CMake OBJECT wiring + instantiation KAT
land in the follow-on 4b commit once #698 is on master.

Header-only declaration; not yet in any build target (inert). Stacked
on #698 (get_work.hpp); held per integrator until #698 lands to avoid
a stacked-PR auto-close.

* dash(S8): DASHWorkSource 4b .cpp bodies + dash_stratum OBJECT lib + KAT

Stage 4b for the DASHWorkSource stratum accept-loop seam (follow-on to the
4a header skeleton). Gives the concrete core::stratum::IWorkSource a linkable
definition so it is INSTANTIABLE and holdable via shared_ptr<IWorkSource> by a
future core::StratumServer, before the substantive X11 work-assembly lands.

work_source.cpp (new):
  - constructor binding the NON-OWNING NodeCoinState reference (embedded arm),
    the REQUIRED dashd getblocktemplate fallback closure (GBT-XCHECK safety,
    never removed), and the dual-path won-block submit callback;
  - real bodies: get_best_share_hash_fn / set_best_share_hash_fn (locked),
    has_merged_chain (false, standalone X11), the per-connection worker
    registry (register/update/unregister, idempotent on unknown sessions);
  - fused get_work() adapter over the free dash::stratum::get_work() capstone
    (#698): embedded when the coin-state is populated, retained dashd fallback
    on a set-gap;
  - work-generation / coinbase / mining_submit / compute_share_difficulty held
    at documented SAFE DEFAULTS (empty template, reject, 0.0 sentinel) for
    4c/4d -- mirrors dgb::stratum::DGBWorkSource 4a->4b->4c->4d progression.

dash_stratum OBJECT lib (stratum/CMakeLists.txt + add_subdirectory): SAFE-ADDITIVE,
compiled here, linked only by the KAT now (and c2pool-dash in a later slice), so
ltc/btc/doge/dgb build + ctest surfaces stay untouched. Per-coin isolation held:
src/impl/dash only, dashd RPC fallback preserved.

test_dash_stratum_work_source (new, 11 KATs, Linux x86_64 11/11): construction +
full IWorkSource contract, config defaults, work-generation counter, share-target
atomics, worker registry, best-share callback, 4b safe-default assertions, and the
fused get_work() routing to the retained dashd fallback on an unpopulated
coin-state. Added to BOTH build.yml --target allowlists (NOT_BUILT sentinel guard).

---------

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
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.

1 participant