Skip to content

Commit b0a92ad

Browse files
authored
Merge pull request #400 from frstrtr/dgb/m3-bind-aux-doge-parsers
dgb(M3): real bind_aux_doge_parsers() body — ODR-use DGB-parent AuxPoW contracts in prod objlib
2 parents c7a7b8b + 4bb65bf commit b0a92ad

4 files changed

Lines changed: 330 additions & 18 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
test_address_resolution test_compute_share_target \
8383
test_utxo test_dgb_subsidy test_dgb_coinbase_value dgb_share_test dgb_redistribute_test dgb_block_assembly_test dgb_header_sample_build_test dgb_header_ingest_test dgb_mempool_ingest_test \
8484
dgb_gentx_coinbase_test dgb_connection_coinbase_test dgb_pplns_payout_split_test nmc_auxpow_merkle_test nmc_template_builder_test nmc_auxpow_wire_test nmc_reconstruct_won_block_test dgb_gentx_share_path_test dgb_conn_pplns_producer_test dgb_other_tx_resolver_test \
85-
dgb_other_tx_assembler_test dgb_reconstruct_won_block_test dgb_reconstruct_closure_test dgb_gentx_unpack_test dgb_work_source_test dgb_template_builder_test dgb_embedded_coin_node_test dgb_embedded_tx_select_test dgb_template_other_txs_test dgb_coinbase_value_parity_test dgb_submit_classify_test dgb_aux_parent_coinbase_parity_test dgb_template_capture_test dgb_aux_doge_db_commitment_bind_test dgb_aux_doge_dc_proof_test \
85+
dgb_other_tx_assembler_test dgb_reconstruct_won_block_test dgb_reconstruct_closure_test dgb_gentx_unpack_test dgb_work_source_test dgb_template_builder_test dgb_embedded_coin_node_test dgb_embedded_tx_select_test dgb_template_other_txs_test dgb_coinbase_value_parity_test dgb_submit_classify_test dgb_aux_parent_coinbase_parity_test dgb_template_capture_test dgb_aux_doge_db_commitment_bind_test dgb_aux_doge_dc_proof_test dgb_aux_doge_bind_parsers_test \
8686
rpc_request_test softfork_check_test genesis_check_test algo_select_test digishield_walk_test header_chain_test \
8787
dgb_coin_node_seam_test dgb_block_broadcast_test dgb_won_block_dispatch_test dgb_forced_won_share_dualpath_test dgb_scrypt_pow_test dgb_nonce_grinder_test dgb_regrind_block_test dgb_won_block_finalize_test dgb_share_target_genesis_test dgb_pool_msg_wire_test dgb_get_shares_walk_test dgb_download_stops_test dgb_think_p1_walk_bounds_test dgb_think_p1_desired_emit_test dgb_think_p6_desired_cutoff_test dgb_think_p4_head_keys_test dgb_think_p3_best_head_test dgb_g1_oracle_byte_parity_test dgb_think_p2_walk_bounds_test dgb_expected_time_to_block_test dgb_pool_efficiency_test dgb_think_p5_best_share_punish_test v37_test \
8888
-j$(nproc)
@@ -214,7 +214,7 @@ jobs:
214214
test_address_resolution test_compute_share_target \
215215
test_utxo test_dgb_subsidy test_dgb_coinbase_value dgb_share_test dgb_redistribute_test dgb_block_assembly_test dgb_header_sample_build_test dgb_header_ingest_test dgb_mempool_ingest_test \
216216
dgb_gentx_coinbase_test dgb_connection_coinbase_test dgb_pplns_payout_split_test nmc_auxpow_merkle_test nmc_template_builder_test nmc_auxpow_wire_test nmc_reconstruct_won_block_test dgb_gentx_share_path_test dgb_conn_pplns_producer_test dgb_other_tx_resolver_test \
217-
dgb_other_tx_assembler_test dgb_reconstruct_won_block_test dgb_reconstruct_closure_test dgb_gentx_unpack_test dgb_work_source_test dgb_template_builder_test dgb_embedded_coin_node_test dgb_embedded_tx_select_test dgb_template_other_txs_test dgb_coinbase_value_parity_test dgb_submit_classify_test dgb_aux_parent_coinbase_parity_test dgb_template_capture_test dgb_aux_doge_db_commitment_bind_test dgb_aux_doge_dc_proof_test \
217+
dgb_other_tx_assembler_test dgb_reconstruct_won_block_test dgb_reconstruct_closure_test dgb_gentx_unpack_test dgb_work_source_test dgb_template_builder_test dgb_embedded_coin_node_test dgb_embedded_tx_select_test dgb_template_other_txs_test dgb_coinbase_value_parity_test dgb_submit_classify_test dgb_aux_parent_coinbase_parity_test dgb_template_capture_test dgb_aux_doge_db_commitment_bind_test dgb_aux_doge_dc_proof_test dgb_aux_doge_bind_parsers_test \
218218
rpc_request_test softfork_check_test genesis_check_test algo_select_test digishield_walk_test header_chain_test \
219219
dgb_coin_node_seam_test dgb_block_broadcast_test dgb_won_block_dispatch_test dgb_forced_won_share_dualpath_test dgb_scrypt_pow_test dgb_nonce_grinder_test dgb_regrind_block_test dgb_won_block_finalize_test dgb_share_target_genesis_test dgb_pool_msg_wire_test dgb_get_shares_walk_test dgb_download_stops_test dgb_think_p1_walk_bounds_test dgb_think_p1_desired_emit_test dgb_think_p6_desired_cutoff_test dgb_think_p4_head_keys_test dgb_think_p3_best_head_test dgb_g1_oracle_byte_parity_test dgb_think_p2_walk_bounds_test dgb_expected_time_to_block_test dgb_pool_efficiency_test dgb_think_p5_best_share_punish_test test_coin_broadcaster test_multiaddress_pplns test_pplns_stress \
220220
v37_test \

src/impl/dgb/coin/node.hpp

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,17 @@
3333
#ifdef AUX_DOGE
3434
// DOGE merged-mining aux module (STRETCH; -DAUX_DOGE=ON only). dgb CONSUMES the
3535
// shared aux types; ltc-doge owns and is the sole modifier of src/impl/doge/coin/aux_*.
36-
// Forward declaration only at slice #3 -- the real
37-
// <impl/doge/coin/aux_chain_embedded.hpp> include lands with the
38-
// bind_aux_doge_parsers() body at M3.
39-
namespace doge { namespace coin { class AuxChainEmbedded; } }
36+
// M3: the REAL shared-module includes that let bind_aux_doge_parsers() instantiate
37+
// the structured AuxPoW parser with the DGB parent coinbase type. Pulling these in
38+
// here (under AUX_DOGE only) is what ODR-USES the DGB-parent template emissions
39+
// (parse_aux_header<dgb::coin::MutableTransaction> / CAuxPow<dgb::coin::Mutable-
40+
// Transaction>) inside the PRODUCTION dgb object library, not merely in fixtures.
41+
#include <functional>
42+
43+
#include <core/pack.hpp> // PackStream (the byte stream the parser reads)
44+
#include <impl/doge/coin/auxpow.hpp> // shared SSOT: CAuxPow<>, parse_aux_header<>, CPureBlockHeader
45+
#include <impl/dgb/coin/transaction.hpp> // dgb::coin::MutableTransaction (the DGB parent coinbase type)
46+
#include <impl/dgb/coin/aux_doge_parent_traits.hpp> // doge::coin::parent_coinbase_no_witness<dgb::coin::MutableTransaction>
4047
#endif
4148

4249
namespace dgb
@@ -47,14 +54,27 @@ namespace coin
4754

4855
#ifdef AUX_DOGE
4956
// ---------------------------------------------------------------------------
50-
// DOGE merged-mining aux seam -- header-only type alias (slice #3, option b per
51-
// integrator UID-904). Names the shared src/impl/doge aux-module backend that
52-
// bind_aux_doge_parsers() wires onto the (M3) coin P2P layer. No new TU; no
53-
// effect on the default Scrypt-only standalone build (which never defines
54-
// AUX_DOGE). The structured parsers consumed at M3 bind time are the free
55-
// functions doge::coin::parse_doge_header / parse_doge_headers_message /
56-
// parse_doge_block (auxpow_header.hpp). Parity: p2pool-merged-v36.
57-
using AuxChainBackend = ::doge::coin::AuxChainEmbedded; // IAuxChainBackend impl
57+
// DOGE merged-mining aux seam (M3 body; -DAUX_DOGE=ON only). The DGB-as-parent
58+
// structured AuxPoW parse contract, bound onto the production dgb object lib by
59+
// bind_aux_doge_parsers(). The shared module's parser is templated on the parent
60+
// coinbase type; here we pin it to dgb::coin::MutableTransaction so the DGB-parent
61+
// CAuxPow<> / parse_aux_header<> template instantiations are emitted and ODR-used
62+
// in production (not only in test fixtures). Parity: p2pool-merged-v36.
63+
//
64+
// AuxDogeParse: the result of feeding a (possibly AuxPoW-extended) DOGE header
65+
// blob through the DGB-parent parser -- the 80-byte child header, the structured
66+
// CAuxPow<dgb> proof, and whether an aux proof was present.
67+
struct AuxDogeParse
68+
{
69+
::doge::coin::CPureBlockHeader m_header; // 80-byte child header
70+
::doge::coin::CAuxPow<dgb::coin::MutableTransaction> m_aux; // structured DGB-parent proof
71+
bool m_has_aux{}; // AuxPoW version-bit present
72+
};
73+
74+
// The bound parser callable: consumes bytes from a PackStream and yields the
75+
// DGB-parent parse. std::function so bind_aux_doge_parsers() can ASSIGN it (real,
76+
// callable binding -- never a no-op), forcing ODR-use of the templated parser.
77+
using AuxDogeParserFn = std::function<AuxDogeParse(PackStream&)>;
5878
#endif
5979

6080
template <typename ConfigType>
@@ -88,10 +108,32 @@ class Node : public dgb::interfaces::Node
88108
NodeRPC* rpc() { return m_rpc.get(); }
89109

90110
#ifdef AUX_DOGE
91-
// DOGE merged-mining aux seam (STRETCH; -DAUX_DOGE=ON only). Binds the shared
92-
// src/impl/doge aux module's parsers onto the (M3) coin P2P layer. Declaration
93-
// only -- no body until NodeP2P is ported. Parity: p2pool-merged-v36.
94-
void bind_aux_doge_parsers();
111+
// DOGE merged-mining aux seam (STRETCH; -DAUX_DOGE=ON only). The DGB-parent
112+
// structured AuxPoW parser, bound by bind_aux_doge_parsers(). Unbound until
113+
// bind is called. Parity: p2pool-merged-v36.
114+
AuxDogeParserFn m_aux_doge_parser;
115+
116+
// Binds the shared src/impl/doge aux module's structured parser onto the dgb
117+
// node, pinned to the DGB parent coinbase type. The body is a genuine callable
118+
// binding (NOT a no-op): it assigns m_aux_doge_parser to a lambda that drives
119+
// bytes through doge::coin::parse_aux_header<dgb::coin::MutableTransaction>().
120+
// Inline (the class is templated; an out-of-line def would need explicit
121+
// instantiation) -- matches the existing inline run(). This is what ODR-USES /
122+
// emits the DGB-parent CAuxPow<> + parse_aux_header<> instantiations in the
123+
// production dgb object library. NodeP2P (not yet ported) will route relayed
124+
// DOGE headers through m_aux_doge_parser at M3 live-dispatch time.
125+
void bind_aux_doge_parsers()
126+
{
127+
m_aux_doge_parser = [](PackStream& s) -> AuxDogeParse {
128+
AuxDogeParse out;
129+
out.m_header = ::doge::coin::parse_aux_header<PackStream, dgb::coin::MutableTransaction>(
130+
s, out.m_aux, out.m_has_aux);
131+
return out;
132+
};
133+
}
134+
135+
// Accessor for the bound parser (test surface + future NodeP2P dispatch).
136+
const AuxDogeParserFn& aux_doge_parser() const { return m_aux_doge_parser; }
95137
#endif
96138
};
97139

src/impl/dgb/test/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,24 @@ if (BUILD_TESTING AND GTest_FOUND)
569569
dgb_coin pool sharechain)
570570
gtest_add_tests(dgb_aux_doge_dc_proof_test "" AUTO)
571571

572+
# --- DGB+DOGE (M3) -- bind_aux_doge_parsers() PRODUCTION-binding KAT --------
573+
# Proves the production dgb node seam coin/node.hpp's bind_aux_doge_parsers()
574+
# is NON-HOLLOW: it instantiates a dgb::coin::Node, calls the (now real) bind
575+
# body, and drives a canonical DGB-parent AuxPoW blob THROUGH the bound member
576+
# -- ODR-USING parse_aux_header<dgb::coin::MutableTransaction> + CAuxPow<dgb::
577+
# coin::MutableTransaction> in the PRODUCTION dgb object library, not merely in
578+
# fixtures. Links the production dgb lib + ltc_coin like the DB/DC siblings --
579+
# the -DAUX_DOGE consumption path legitimately couples to ltc. Test-only;
580+
# consumes the shared module, modifies nothing in src/impl/doge. MUST appear in
581+
# BOTH this registration AND the build.yml --target allowlist (#143 NOT_BUILT).
582+
add_executable(dgb_aux_doge_bind_parsers_test aux_doge_bind_parsers_test.cpp)
583+
target_link_libraries(dgb_aux_doge_bind_parsers_test PRIVATE
584+
GTest::gtest_main GTest::gtest
585+
core dgb ltc_coin
586+
c2pool_payout c2pool_merged_mining c2pool_hashrate c2pool_storage
587+
dgb_coin pool sharechain)
588+
gtest_add_tests(dgb_aux_doge_bind_parsers_test "" AUTO)
589+
572590
# dgb_share_target_genesis_test: FENCED KAT pinning ShareTracker::compute_
573591
# share_target genesis/unknown-prev clamp to [MAX_TARGET/30, MAX_TARGET] vs
574592
# the DGB oracle data.py generate_transaction. Links the same proven set as

0 commit comments

Comments
 (0)