Skip to content

dgb: Phase-B batch land — #132->#142 + test fixtures onto master (CI: -DCOIN_DGB=ON + dgb_share_test) - #145

Merged
frstrtr merged 9 commits into
masterfrom
dgb/land-phaseB-batch
Jun 18, 2026
Merged

dgb: Phase-B batch land — #132->#142 + test fixtures onto master (CI: -DCOIN_DGB=ON + dgb_share_test)#145
frstrtr merged 9 commits into
masterfrom
dgb/land-phaseB-batch

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner

DGB Phase-B batch land — single rebase/land PR onto master

Lands the strict-linear Phase-B DGB pool/share stack (#132 to #142) plus the
test-fixtures slice (a84a149) as ONE PR onto current master (bb7ef22), per
integrator's merge-cadence gate. Replaces five separate merges with one
operator-tap-gated land whose head SHA carries the full CI rollup.

Contents (9 commits, strict-linear, all GPG-signed)

CI gate fix (the #137 NOT_BUILT class)

The DGB module (src/impl/dgb) is gated behind if(COIN_DGB) and no option()
defaults it ON, so CI has never actually compiled the dgb module.
test_dgb_subsidy passed only because it lives in the global test/ dir,
outside the gate. This PR:

  1. Sets -DCOIN_DGB=ON in the Linux and ASan configure steps, so the dgb
    OBJECT lib + dgb_coin + pool/share TU compile under CI (Linux + ASan/UBSan)
    for the first time — the Phase-B code is no longer dark.
  2. Adds dgb_share_test to the --target allowlist in BOTH jobs (Linux ~L70,
    ASan ~L196), alongside test_dgb_subsidy. dgb_share_test lives inside the
    COIN_DGB gate and links the dgb OBJECT lib, so it only exists once (1) sets
    the flag.

Configure line (confirms -DCOIN_DGB)

Linux: cmake -S . -B build_ci -DCMAKE_TOOLCHAIN_FILE=build_ci/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCOIN_DGB=ON
ASan: cmake -S . -B build_asan -DCMAKE_TOOLCHAIN_FILE=build_asan/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCOIN_DGB=ON -DCMAKE_CXX_FLAGS=...

Local verification (workstation, gcc13/Release)

  • CFG_EXIT=0, BUILD_EXIT=0 — c2pool + test_dgb_subsidy + dgb_share_test (full dgb OBJECT lib + pool TU compiled under COIN_DGB=ON)
  • dgb_share_test 5/5 PASS: OracleSharechainIdentity, OracleConsensusParams, OracleDonationScript, AddressVersions, LoadShareSymbolLinks
  • Conforms vs own oracle frstrtr/p2pool-dgb-scrypt (IDENTIFIER 4B62545B1A631AFE)

HOLD merge — operator tap gates the land. Reviewer/sequence per integrator.

frstrtr added 9 commits June 18, 2026 01:06
The best-chain score() hardcoded a 15s block period (a dead farsider350
digibyte.py holdover) for time_span = block_height * BLOCK_PERIOD, bypassing
the oracle-conformed PARENT.BLOCK_PERIOD (75s, config_coin.hpp). Source it
from the make_coin_params-populated m_params->block_period so there is one
SSOT for the DGB Scrypt-only parent period and no hardcoded consensus
holdover in the score path. Stale confirmation comments updated (1=tip->75s).
Replace the compiling node.cpp/node.hpp skeleton with the full pool-layer
NodeImpl, ported near-mechanically from impl/ltc (namespace ltc -> dgb;
LevelDB net names litecoin -> digibyte). node.cpp now compiles share_tracker.hpp
and share_check.hpp into a real translation unit, exercising the chain-score path.

- node.hpp: BaseNode<dgb::Config, dgb::ShareChain, dgb::Peer>, async share
  downloader, tracker mutex/compute pipeline, broadcast, download, admin API.
  Config aggregator (core::Config<PoolConfig, CoinConfig>) declared inline since
  the dgb tree splits config into config_pool.hpp + config_coin.hpp (no
  config.hpp aggregator header).
- node.cpp: full run-loop body (think, clean_tracker, prune, PPLNS window,
  heartbeat, outbound connection maintenance, whitelist/ban admin).
- protocol_actual.cpp / protocol_legacy.cpp: per-message handlers (Actual/Legacy).
- config_pool.cpp / config_coin.cpp: Fileconfig load()/get_default() bodies;
  config_coin.hpp gains the YAML convert<> specializations for P2PData/RPCData.
- CMakeLists.txt: add dgb OBJECT lib (mirrors ltc lib) linking
  core/pool/sharechain/dgb_coin/btclibs/c2pool_storage/secp256k1; the dgb
  NodeImpl TU builds clean (target dgb).

Coin-isolation preserved: changes confined to src/impl/dgb/. Wiring the
c2pool-dgb executable to this lib requires edits in src/c2pool/ (main_dgb.cpp
+ CMakeLists.txt) which are out of scope for this slice.
The exe-wire slice repairs c2pool-dgb after #134 replaced the skeleton
node.cpp with the real abstract dgb::NodeImpl, orphaning the
run_skeleton/network_summary symbols the old stub main linked against.

main_dgb.cpp now drives the LIVE score path: it constructs dgb::ShareTracker
and calls score() (header-only, #132/#134), reporting the oracle block_period
(75s SSOT) the time_span derivation consumes. It never stands up the abstract
NodeImpl, so the full pool run-loop is not pulled in.

Isolation: the real node.cpp TU references core web_server/stratum, which the
core OBJECT lib links unconditionally and which drag in payout/merged/hashrate/
ltc (Phase B self-link tangle; merged = DOGE aux, NOT in the V36 default DGB
build). We therefore do NOT compile node.cpp into the exe and do NOT link core.
Instead we compile core/uint256.cpp directly and link the btclibs STATIC util
lib (HexStr/HexDigit) - pure utility, no pool runtime. Per-coin isolation held;
only the c2pool-dgb target changed; sibling coin exes still build.
Port of LTC whale_departure.hpp into the dgb namespace: 30-min rolling
hashrate window that detects whale departure (drop below 50% baseline)
and signals desired-target override toward pre_target3. Non-consensus,
local-only; matches p2pool-v36 work.py Phase 1c + 1c.1.

Compiled into the real node TU as an additive NodeImpl member; detect()
wiring into the desired-target path is the next slice. No shared-base or
src/core churn, single-tree under src/impl/dgb. c2pool-dgb builds clean.
…ride

Drive WhaleDepartureDetector::detect() from run_think() under the exclusive
tracker lock with the fresh best-share hash (race-free, share-batch cadence).
Publish the verdict to an atomic m_whale_departure_active and expose
local_desired_target(): when recovery is active the local mining target is
eased to pre_target3 (== MAX_TARGET, easiest consensus difficulty); otherwise
the normal desired target passes through. Non-consensus -- only affects what
this node mines, never share verification. Closes the loop on the pillar
landed in the prior slice (detector was dormant until it drove the override).

3-bucket: per-coin isolation (non-consensus local heuristic, src/impl/dgb/
only). redistribute.hpp deferred -- not a hard compile dep (comment-only
reference in share_check.hpp; file absent on branch).
…ayer)

Port p2pool-v36 monitor.py (commit d831a045) into src/impl/dgb/pool_monitor.hpp,
mirroring src/impl/ltc/pool_monitor.hpp. Emits grep-friendly [MONITOR-*] log
lines (hashrate spike/drop, per-address work concentration, share-gap/emergency
decay, difficulty anomaly, summary). Consensus-NEUTRAL: pure observability, no
sharechain/consensus effect.

DGB divergence vs the LTC source is the address encoder only: the LTC version
used the is_litecoin convenience overload (litecoin/bitcoin-only). DGB passes
explicit Base58/bech32 version bytes from CoinParams via the 4-arg
core::script_to_address overload (D/S prefixes, dgb/dgbt HRP).

Wired into NodeImpl::run_think() on a ~30s wall-clock cadence under the existing
exclusive tracker lock, alongside the whale-departure detector. Completes the
fmt_hashrate seam whale_departure.hpp forward-references.

No edits to src/impl/bitcoin_family or src/core (consume-only). c2pool-dgb
single-coin build EXIT=0.
… guard)

Enable add_subdirectory(test) and add dgb_share_test, mirroring the
ltc/btc test pattern. The test links the dgb OBJECT lib (pool/share TU)
into a gtest executable, build-verifying the Phase-B pool/share stack,
and asserts the DGB-oracle-conformed (frstrtr/p2pool-dgb-scrypt)
consensus + sharechain-identity params adjudicated at prescan-DGB:

  - IDENTIFIER 4b62545b1a631afe / PREFIX 1c0553f23ebfcffe (isolation
    primitives — must stay byte-exact per coin)
  - SEGWIT_ACTIVATION_VERSION 35, P2P_PORT 5024, proto floor 1700 /
    advertised 3301, SHARE_PERIOD 15, CHAIN_LENGTH 2880
  - v35 donation = forrestv P2PK (4104ffd0..ac, 67B); v36 = combined
    P2SH (23B) via get_donation_script() version switch
  - ADDRESS_VERSION 0x1e (D) / ADDRESS_P2SH_VERSION 0x3f (S)

Locks the conformance landed in the stack against silent regression.
Local build EXIT=0; dgb_share_test 5/5 PASS. Non-stacking lane off
stack tip; captured-block PoW + multi-algo accept-by-continuity
fixtures are a follow-up (see test/README.txt).
…arget

Two coupled fixes so the Phase-B DGB stack is actually build-verified by CI:

1. Set -DCOIN_DGB=ON in the Linux and ASan configure steps. The dgb
   coin module (src/impl/dgb) is gated behind if(COIN_DGB); no option()
   defaults it ON, so CI never compiled the module. test_dgb_subsidy
   passed only because it lives in the global test/ dir, outside the
   gate. Enabling the flag compiles the dgb OBJECT lib + dgb_coin +
   pool/share TU for the first time under CI (Linux + ASan/UBSan).

2. Add dgb_share_test to the --target allowlist in both jobs. It is
   defined in src/impl/dgb/test (inside the COIN_DGB gate) and links the
   dgb OBJECT lib, so it only exists once (1) sets the flag. Mirrors the
   #137 NOT_BUILT lesson: a gtest target must be in the build allowlist.
@frstrtr
frstrtr merged commit d5879c9 into master Jun 18, 2026
16 checks passed
frstrtr added a commit that referenced this pull request Jun 18, 2026
Port the real boost::beast + jsonrpccxx HTTP JSON-RPC client to an
external digibyted, mirroring src/impl/btc/coin/rpc.{hpp,cpp}. This is
the external-daemon FALLBACK path V36 mandates persist alongside the
embedded daemon.

- rpc.hpp: NodeRPC promoted from Path-A stub to real client surface
  (connect/reconnect/getwork/submit_block[_hex]/check + RPC methods).
- rpc.cpp: ~440L transport mirror of btc, with DGB conformance:
  * getblocktemplate sends {"rules":["segwit"],"algo":"scrypt"} --
    Scrypt is the mining algo (separate GBT param), NOT a BIP9 rule;
    fixes the incorrect Path-A stub note rules=["scrypt"].
  * check(): chain-identity probe via DigiByte genesis hash
    (mainnet/testnet by IS_TESTNET) + daemon version floor
    [confirm-vs-oracle on exact floor] + required-softfork gate.
- softfork_check.hpp: 1:1 helper normalising the three getblockchaininfo
  softfork encodings (array-of-objects / array-of-strings / bip9 object).

CMake/OBJECT-lib registration + construction-site ctor swap deferred to
the post-#145 base (the surface #145 restructures); this commit is
additive coin-layer source, build-verified standalone (TU compile
EXIT=0).
frstrtr added a commit that referenced this pull request Jun 18, 2026
Pin collect_softfork_names() (softfork_check.hpp) across all three
getblockchaininfo softfork encodings (array-of-objects / array-of-strings /
object-keyed) plus accumulation + scalar no-op robustness. Guards the
softfork-gate parser NodeRPC uses to confirm segwit before trusting the
Scrypt GBT path, BEFORE the deferred post-#145 wiring CI-links rpc.cpp.

Header-only + nlohmann + gtest, no transport link -- standalone, does not
enter the dgb OBJECT lib.
frstrtr added a commit that referenced this pull request Jun 18, 2026
Factor the DigiByte genesis hashes NodeRPC::check() probes out of rpc.cpp
into the rpc_request.hpp SSOT (DGB_GENESIS_MAIN/TEST + dgb_genesis_hash()
selector), mirroring how the daemon-version floor was made SSOT+guarded.
rpc.cpp now consumes them; the genesis hashes are a bucket-1 isolation
primitive (coin-identity, KEEP per-coin v36/v37, never standardized) --
pinned here only so a standalone TU can guard them.

Add test/genesis_check_test.cpp (7 cases): canonical mainnet/testnet
hashes, main != test (no copy/paste), 64-hex shape, and the IS_TESTNET
selector NodeRPC::check() relies on. Links only the pure SSOT header +
gtest -- no boost::beast transport, builds standalone (7/7 PASS).

CMake/OBJECT-lib registration of this test deferred to the post-#145 base
with the rest of the transport wiring.
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