dgb: M3 external-daemon RPC transport (coin-layer source + guards) - #149
Merged
Conversation
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).
DGB_MIN_DAEMON_VERSION resolved against frstrtr/p2pool-dgb-scrypt networks/digibyte.py VERSION_CHECK (oracle HEAD 22761e7): floor is 82202 (DigiByte Core 7.17.2), not the placeholder 71700. Gates the same getnetworkinfo[version] field the oracle does, so the check is oracle-equivalent. Closes the last [confirm-vs-oracle] on the M3 RPC transport slice.
Factor the two oracle-pinned external-RPC contract values out of rpc.cpp
into a pure, dependency-light header (coin/rpc_request.hpp) so they have a
single source of truth and can be guarded by a standalone test that does
NOT link the boost::beast/jsonrpccxx transport (never enters the dgb
OBJECT lib):
- DGB_MIN_DAEMON_VERSION / daemon_version_acceptable(): getnetworkinfo
[version] accept floor, conformed to oracle frstrtr/p2pool-dgb-scrypt
VERSION_CHECK == 82202 (DigiByte Core 7.17.2).
- make_gbt_request(): getblocktemplate body {rules:[...],algo:scrypt} --
segwit rule mandatory, scrypt is a SEPARATE algo param, never a rule.
rpc.cpp now consumes the header (behaviour-identical: version compare and
GBT body unchanged on the wire). Adds test/rpc_request_test.cpp (8 gtest
cases) pinning the floor accept/reject boundary (82202 ok / 82201,71700
reject) and the GBT shape incl. the Path-A scrypt-as-rule regression.
Standalone build-verified: g++ -std=c++20, link libgtest -> 8/8 PASS;
rpc.cpp -fsyntax-only EXIT=0. No CMake/OBJECT-lib wiring (deferred post
land-stack); additive coin-layer source only.
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.
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.
Register the three standalone M3 regression guards (rpc_request_test / softfork_check_test / genesis_check_test) as ctest targets in src/impl/dgb/test/CMakeLists.txt and add them to BOTH build.yml --target allowlists. Header-only: each links only GTest + nlohmann_json (no OBJECT lib), so they stay buildable while the external-daemon transport rpc.cpp wiring remains deferred (Option-B). Avoids the #143 NOT_BUILT trap: a gtest target present in CMake but absent from the build.yml allowlist becomes a NOT_BUILT sentinel that reds master. Both lists, always. 23/23 guard assertions pass (rpc-request 8, softfork 8, genesis 7).
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.
M3 DGB external-daemon RPC transport — coin-layer SOURCE only (Option-B scope: transport rpc.cpp wiring deferred post-merge). Per-coin isolation clean; src/impl/dgb/ only.
Contents (6 commits onto master @d5879c9b)
2bc081e3external-daemon RPC transport coin-layer (rpc.hpp stub->real + ~440L rpc.cpp btc-mirror + softfork_check.hpp)24515a73conform daemon-version floor to oracle 71700->82202 (DGB Core 7.17.2 VERSION_CHECK)00c39ebeRPC request-shape SSOT (floor 82202 + make_gbt_request {rules:[segwit], algo:scrypt}) + guardfc2ec32bsoftfork-detection standalone guard (3 encodings + robustness)29a0ce86chain-identity genesis SSOT (DGB_GENESIS_MAIN/TEST + selector, bucket-1 isolation primitive) + guard0095da79wire all 3 guards into ctest + BOTH build.yml --target allowlists (avoids ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT trap)Scope notes
Verification
HOLD MERGE — integrator surfaces the merge card on operator approval.