Skip to content

Commit 6de623b

Browse files
committed
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).
1 parent 7aacd01 commit 6de623b

7 files changed

Lines changed: 490 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
core_test sharechain_test share_test btc_share_test \
115115
test_threading test_weights \
116116
test_header_chain test_mempool test_template_builder \
117-
test_doge_chain test_compact_blocks test_dash_x11_kat test_dash_header_chain test_dash_block_replay test_dash_conformance test_dash_subsidy test_dash_mempool test_dash_simplifiedmns test_dash_quorum test_dash_quorum_root test_dash_mn_state test_dash_embedded_gbt test_dash_smldiff test_dash_p2p_messages test_dash_p2p_connection test_dash_p2p_node test_dash_node_interface test_dash_config test_dash_broadcaster test_dash_broadcaster_full test_dash_share_hash_link test_dash_block_relay test_dash_rpc_request test_dash_rpc_conf test_dash_block_producer test_dash_embedded_relay_e2e test_dash_block_relay_plan test_dash_version_activation_latch test_dash_block_relay_binding test_dash_block_relay_dual_arm test_dash_coinbase_parity test_dash_coinbase_muldiv test_dash_donation_combined test_dash_g3_assembled test_dash_work_target test_dash_work_job_targets test_dash_stratum_binding test_dash_job_notify_roundtrip test_dash_cb_payee test_dash_stratum_notify_roundtrip test_dash_poolnode_messages test_dash_peer test_dash_share_tracker test_dash_node test_dash_share_messages test_dash_stratum_extranonce_split test_dash_stratum_submit_reassembly test_dash_difficulty_parity test_dash_auto_ratchet test_dash_min_protocol_gate test_dash_work_source test_dash_node_coin_state test_dash_coin_state_maintainer test_dash_node_embedded_wire test_dash_node_reception_wire test_dash_get_work \
117+
test_doge_chain test_compact_blocks test_dash_x11_kat test_dash_header_chain test_dash_block_replay test_dash_conformance test_dash_subsidy test_dash_mempool test_dash_simplifiedmns test_dash_quorum test_dash_quorum_root test_dash_mn_state test_dash_embedded_gbt test_dash_smldiff test_dash_p2p_messages test_dash_p2p_connection test_dash_p2p_node test_dash_node_interface test_dash_config test_dash_broadcaster test_dash_broadcaster_full test_dash_share_hash_link test_dash_block_relay test_dash_rpc_request test_dash_rpc_conf test_dash_block_producer test_dash_embedded_relay_e2e test_dash_block_relay_plan test_dash_version_activation_latch test_dash_block_relay_binding test_dash_block_relay_dual_arm test_dash_coinbase_parity test_dash_coinbase_muldiv test_dash_donation_combined test_dash_g3_assembled test_dash_work_target test_dash_work_job_targets test_dash_stratum_binding test_dash_job_notify_roundtrip test_dash_cb_payee test_dash_stratum_notify_roundtrip test_dash_poolnode_messages test_dash_peer test_dash_share_tracker test_dash_node test_dash_share_messages test_dash_stratum_extranonce_split test_dash_stratum_submit_reassembly test_dash_difficulty_parity test_dash_auto_ratchet test_dash_min_protocol_gate test_dash_work_source test_dash_node_coin_state test_dash_coin_state_maintainer test_dash_node_embedded_wire test_dash_node_reception_wire test_dash_get_work test_dash_stratum_work_source \
118118
test_multiaddress_pplns test_pplns_stress \
119119
test_hash_link test_decay_pplns \
120120
test_pplns_consensus \
@@ -271,7 +271,7 @@ jobs:
271271
test_threading test_weights \
272272
test_header_chain test_mempool test_template_builder \
273273
test_doge_chain test_compact_blocks test_dash_x11_kat \
274-
test_dash_header_chain test_dash_block_replay test_dash_conformance test_dash_subsidy test_dash_mempool test_dash_simplifiedmns test_dash_quorum test_dash_quorum_root test_dash_mn_state test_dash_embedded_gbt test_dash_smldiff test_dash_p2p_messages test_dash_p2p_connection test_dash_p2p_node test_dash_node_interface test_dash_config test_dash_broadcaster test_dash_broadcaster_full test_dash_share_hash_link test_dash_block_relay test_dash_rpc_request test_dash_rpc_conf test_dash_block_producer test_dash_embedded_relay_e2e test_dash_block_relay_plan test_dash_version_activation_latch test_dash_block_relay_binding test_dash_block_relay_dual_arm test_dash_coinbase_parity test_dash_coinbase_muldiv test_dash_donation_combined test_dash_g3_assembled test_dash_work_target test_dash_work_job_targets test_dash_stratum_binding test_dash_job_notify_roundtrip test_dash_cb_payee test_dash_stratum_notify_roundtrip test_dash_poolnode_messages test_dash_peer test_dash_share_tracker test_dash_node test_dash_share_messages test_dash_stratum_extranonce_split test_dash_stratum_submit_reassembly test_dash_difficulty_parity test_dash_auto_ratchet test_dash_min_protocol_gate test_dash_work_source test_dash_node_coin_state test_dash_coin_state_maintainer test_dash_node_embedded_wire test_dash_node_reception_wire test_dash_get_work \
274+
test_dash_header_chain test_dash_block_replay test_dash_conformance test_dash_subsidy test_dash_mempool test_dash_simplifiedmns test_dash_quorum test_dash_quorum_root test_dash_mn_state test_dash_embedded_gbt test_dash_smldiff test_dash_p2p_messages test_dash_p2p_connection test_dash_p2p_node test_dash_node_interface test_dash_config test_dash_broadcaster test_dash_broadcaster_full test_dash_share_hash_link test_dash_block_relay test_dash_rpc_request test_dash_rpc_conf test_dash_block_producer test_dash_embedded_relay_e2e test_dash_block_relay_plan test_dash_version_activation_latch test_dash_block_relay_binding test_dash_block_relay_dual_arm test_dash_coinbase_parity test_dash_coinbase_muldiv test_dash_donation_combined test_dash_g3_assembled test_dash_work_target test_dash_work_job_targets test_dash_stratum_binding test_dash_job_notify_roundtrip test_dash_cb_payee test_dash_stratum_notify_roundtrip test_dash_poolnode_messages test_dash_peer test_dash_share_tracker test_dash_node test_dash_share_messages test_dash_stratum_extranonce_split test_dash_stratum_submit_reassembly test_dash_difficulty_parity test_dash_auto_ratchet test_dash_min_protocol_gate test_dash_work_source test_dash_node_coin_state test_dash_coin_state_maintainer test_dash_node_embedded_wire test_dash_node_reception_wire test_dash_get_work test_dash_stratum_work_source \
275275
test_hash_link test_decay_pplns \
276276
test_pplns_consensus \
277277
test_v36_script_sorting test_v36_cross_impl_refhash \

src/impl/dash/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
# dash_x11, so ltc/btc/doge/dgb build + ctest surfaces are untouched.
99
add_subdirectory(crypto)
1010

11+
# S8 stratum work-source module (dash::stratum::DASHWorkSource, the concrete
12+
# core::stratum::IWorkSource). OBJECT lib compiled here; linked by c2pool-dash +
13+
# the test_dash_stratum_work_source KAT only. SAFE-ADDITIVE, src/impl/dash only.
14+
add_subdirectory(stratum)
15+
1116
# S5 block-replay slice (PR-0 foundation decomposition): compact-block
1217
# reconstruction primitives (BIP-152 short-tx-id / PartiallyDownloadedBlock),
1318
# vendored from dashcore with the C2POOL_SERIALIZE_METHODS idiom. SAFE-ADDITIVE:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# dash::stratum module -- concrete core::stratum::IWorkSource implementation for
2+
# c2pool-dash (DASH X11, V36). Bridges the coin-agnostic core::StratumServer
3+
# (TCP, JSON-RPC, sessions, vardiff, rate monitor) to DASH work generation +
4+
# share validation: the fused get_work() capstone (#698) sources a base template
5+
# off the node-held NodeCoinState (embedded arm) or the RETAINED dashd GBT RPC
6+
# fallback ([GBT-XCHECK], never removed), and the 4d hot path runs the X11 PoW.
7+
#
8+
# OBJECT lib (mirrors src/impl/dash/CMakeLists.txt add_library(dash OBJECT ...)):
9+
# the work-source TU compiles against the header-only coin selector + get_work
10+
# capstone; only c2pool-dash (and the test_dash_stratum_work_source KAT) link the
11+
# objects in, so ltc/btc/doge/dgb build + ctest surfaces stay untouched.
12+
# SAFE-ADDITIVE, per-coin isolation held: src/impl/dash only, dashd RPC fallback
13+
# preserved. Stage 4b: bodies landed (getters + registry + get_work adapter real;
14+
# X11 work-assembly + share-validation held at safe defaults for 4c/4d).
15+
add_library(dash_stratum OBJECT
16+
work_source.hpp work_source.cpp
17+
)
18+
target_include_directories(dash_stratum PUBLIC
19+
${CMAKE_SOURCE_DIR}/src
20+
${CMAKE_SOURCE_DIR}/src/btclibs
21+
${CMAKE_SOURCE_DIR}/include)
22+
target_link_libraries(dash_stratum core dash_x11 nlohmann_json::nlohmann_json ${Boost_LIBRARIES})

0 commit comments

Comments
 (0)