dash(underfill): port near-empty-template guard to DASH embedded GBT + KAT#724
Merged
Conversation
Port the 'near-empty template on a non-empty mempool' guard from ltc/doge template_builder.hpp into dash build_embedded_workdata() (the DASH embedded template path), for the mining-hotel deployment. - Same cross-coin pins as LTC/DOGE: UNDERFILL_MIN_FILL_BYTES / UNDERFILL_BACKLOG_SLACK = 50 kB (legacy p2pool near-empty floor). - Trip condition factored into a pure predicate underfill_guard_trips(selected, mempool_bytes, known_fees) so the KAT pins the exact boolean without a log scraper. - selected_bytes accumulated from SelectedTx.base_size (DASH has no witness; base_size IS the wire size the mempool byte cap counts). - Log-only (WARNING, [GBT-EMB] UNDERFILL) exactly like LTC/DOGE: never mutates the template; masternode burn/payee projection and the dashd submitblock fallback path are untouched. - SAFE-ADDITIVE trailing seam bool* underfill_tripped = nullptr (matches the existing curtime/version seam style); every existing caller is byte-for-byte unchanged. - test_dash_underfill_guard.cpp: predicate boundary KATs (empty mempool never trips, fee-unknown backlog never trips, strict slack boundary) + build wiring KATs (fee-known backlog rejected by the stale-input window trips; drained small pool and empty pool do not; DASH payment projection asserted unchanged when tripped; default-seam call identical field-for-field).
…ists Registered in test/CMakeLists.txt but absent from the Linux x86_64 and ASan --target lists, so it showed ***Not Run and failed those two lanes. Add it next to test_dash_embedded_gbt in both lists, mirroring the test_stratum_hotel_interim fix.
frstrtr
added a commit
that referenced
this pull request
Jul 17, 2026
…728) * btc/dgb/bch(underfill): port LTC/DOGE near-empty-template guard + KATs Port the v36 template-underfill guard (near-empty template on a non-empty fee-paying mempool, LOG-ONLY WARNING) from LTC/DOGE to the three coins that were missing it, in the DASH free-predicate form (underfill_guard_trips + 50 kB UNDERFILL_MIN_FILL_BYTES / UNDERFILL_BACKLOG_SLACK pins): - btc: guard inside TemplateBuilder::build_template (template_builder.hpp), SAFE-ADDITIVE trailing bool* underfill_tripped seam; GBT JSON untouched. - bch: same, after the CTOR re-sort; ABLA budget / sizelimit untouched. - dgb: build_work_template() is a pure shaper with no mempool access, so the guard evaluates in make_mempool_tx_source (embedded_tx_select.cpp) — the one mempool-visible point feeding BOTH template callers (stratum DGBWorkSource + EmbeddedCoinNode); predicate/thresholds pinned in coin/template_builder.hpp. KATs per coin (test/test_{btc,dgb,bch}_underfill_guard.cpp, mirroring test_dash_underfill_guard.cpp): threshold pins, boundary strictness, empty/fee-unknown/drained no-trip, and real-build wiring via the seam (stale-input-guard-emptied selection over a fee-paying backlog). Registered in test/CMakeLists.txt (bch entry gated on COIN_BCH like bch_coin). New targets still need the build.yml --target allowlist (main leg: btc+dgb; BCH leg: bch) or CTest shows the NOT_BUILT sentinel. * ci(build): allowlist btc/dgb/bch underfill-guard gtests (#728) test_btc_underfill_guard + test_dgb_underfill_guard -> main-leg --target lists (build_ci + build_asan); test_bch_underfill_guard -> BCH-leg lists (build_bch build + run, COIN_BCH). Without these the new KATs register as NOT_BUILT CTest sentinels and Not-Run on Linux/ASan. Same pattern as #721/#724. --------- Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the block-underfill guard to DASH (exists on LTC/DOGE, not DASH) for the mining-hotel deployment. DASH has no template_builder class; the guard goes in build_embedded_workdata() (src/impl/dash/coin/embedded_gbt.hpp), after tx selection and BEFORE the platform-burn/MN-payee/CbTx section (masternode payment, CbTx, dashd submitblock fallback untouched). Behavior mirrors LTC/DOGE: 50kB fill pins; near-empty template + non-empty fee-paying mempool backlog => LOG_WARNING '[GBT-EMB] UNDERFILL:'. Log-only. Adds test/test_dash_underfill_guard.cpp (asserts the DIP-0027 MN-payment projection stays unchanged) + CMakeLists registration. NOTE: the new gtest must be added to the build.yml --target allowlist (workflow scope) or it shows '***Not Run'.