diff --git a/src/impl/dgb/CMakeLists.txt b/src/impl/dgb/CMakeLists.txt new file mode 100644 index 000000000..0a4f3566c --- /dev/null +++ b/src/impl/dgb/CMakeLists.txt @@ -0,0 +1,24 @@ +# c2pool-dgb coin module (V36). Built when -DCOIN_DGB=ON. +# Mirrors src/impl/btc/CMakeLists.txt; emits the c2pool-dgb binary. +# Per-coin binary scheme: project_v36_per_coin_binary_v37_unified_process. +# Impl plan: c2pool-dgb-embedded-impl-plan.md (frstrtr/the docs/v36, 8ef8d2d). +# +# SCOPE (M1 / project_v36_dgb_scrypt_only): V36 validates SCRYPT blocks only. +# Other 4 DGB algos (SHA256d, Skein, Qubit, Odocrypt) = accept-by-continuity +# or ignored. Full 5-algo validation is DEFERRED TO V37. +# +# -DAUX_DOGE opt-in (DGB-as-DOGE-parent, the dual-parent stretch) is NOT wired +# in this module yet: parked behind the Phase 5.8 settle (ltc-doge owns the +# shared DOGE-aux surface). Do not add AUX_DOGE plumbing here at M2. +# +# TODO(M3): add_library(impl_dgb ...) sources as an OBJECT lib (ci-steward +# PR-CMake-object-library convention; impl_dgb = 1 of 5 per-coin OBJECT libs), +# link bitcoin_family/Scrypt shared base, wire embedded DigiByte Core daemon +# slice under daemon/. Top-level add_subdirectory(src/impl/dgb) registration +# follows the OBJECT-lib convention PR; held ~2-3 heartbeats, not raced here. +if(COIN_DGB) + message(STATUS "c2pool: DGB Scrypt-only coin module enabled (skeleton)") + # add_subdirectory(coin) + # add_subdirectory(daemon) + # add_subdirectory(test) +endif() diff --git a/src/impl/dgb/coin/header_chain.hpp b/src/impl/dgb/coin/header_chain.hpp new file mode 100644 index 000000000..1694d8fb6 --- /dev/null +++ b/src/impl/dgb/coin/header_chain.hpp @@ -0,0 +1,38 @@ +#pragma once +// DGB header-chain validation. Mirrors src/impl/btc/coin/header_chain.hpp, +// shares the Scrypt PoW path with src/impl/ltc (identical Scrypt to LTC). +// +// >>> SCRYPT-ONLY VALIDATION POINT (M1 §2, project_v36_dgb_scrypt_only) <<< +// DGB is a 5-algo chain (Scrypt, SHA256d, Skein, Qubit, Odocrypt). In V36 +// c2pool-dgb validates the SCRYPT path ONLY: +// - Scrypt block header -> full PoW validate (this slice) +// - non-Scrypt block header -> accept-by-continuity (extend headers, +// do NOT PoW-validate) OR ignore +// - malformed / wrong-magic -> reject +// Algo is selected from the DGB version field (multi-algo encoding). Full +// 5-algo validation is V37 scope — do NOT add Skein/Qubit/Odocrypt/SHA256d +// PoW here. +// +// >>> THIRD INVARIANT: ACCEPT-BY-CONTINUITY HEADERS ARE WORK-NEUTRAL <<< +// (PR #60, dash-consensus review) +// A non-Scrypt header accepted by continuity extends the header chain, but its +// un-validated PoW MUST NOT contribute to sharechain cumulative work or +// best-chain selection. Continuity headers carry zero weight in work +// accounting. Otherwise an attacker feeds cheap non-Scrypt headers to inflate +// cumulative work — a consensus divergence vs p2pool-merged-v36 AND a DoS +// surface. This is the multi-algo analogue of the DASH case where DGW fully +// overrides the base 2016-block retarget (the base path is never reached). +// M3 MUST honor this in BOTH HeaderChain::validate() (no work credited for +// continuity headers) and the DigiShield window (continuity headers excluded +// from the retarget walk — see below). +// +// >>> DIGISHIELD INSERTION POINT (M1 §2) <<< +// DGB uses DigiShield/MultiShield per-algo difficulty retarget, NOT BTC's +// 2016-block retarget. TODO(M3): port per-algo DigiShield target calc for the +// Scrypt algo lane only. +// TODO(M3): the DigiShield difficulty window MUST walk Scrypt-algo ancestors +// ONLY — never the interleaved multi-algo header chain. On a mixed-algo chain +// the previous-block / window walk must skip non-Scrypt (continuity) headers; +// folding them into the window corrupts the Scrypt retarget and re-introduces +// the work-neutrality break above. Easy to get wrong on a mixed-algo chain. +namespace c2pool::dgb { /* TODO(M3): HeaderChain w/ Scrypt-only validate() + accept-by-continuity */ } diff --git a/src/impl/dgb/coin/template_builder.hpp b/src/impl/dgb/coin/template_builder.hpp new file mode 100644 index 000000000..da15d2569 --- /dev/null +++ b/src/impl/dgb/coin/template_builder.hpp @@ -0,0 +1,13 @@ +#pragma once +// DGB block-template builder. Mirrors src/impl/btc/coin/template_builder.hpp. +// Must emit p2pool-merged-v36-compatible templates (V36 master compat). +// +// >>> SCRYPT GBT FILTER POINT (M1 §3) <<< +// DGB multi-algo: getblocktemplate is requested with rules=["scrypt"] so the +// embedded daemon only returns Scrypt-eligible templates. The builder assembles +// and submits Scrypt blocks only in V36. (config_coin.hpp CoinParams::GBT_ALGO.) +// +// Share/PoW format is identical to LTC Scrypt; share assembly reuses the shared +// Scrypt-family path (do NOT fork LTC share logic — per-coin isolation). +// TODO(M3): TemplateBuilder emitting p2pool-merged-v36-parity Scrypt templates. +namespace c2pool::dgb { /* TODO(M3): TemplateBuilder, Scrypt GBT */ } diff --git a/src/impl/dgb/daemon/README.txt b/src/impl/dgb/daemon/README.txt new file mode 100644 index 000000000..c4c356153 --- /dev/null +++ b/src/impl/dgb/daemon/README.txt @@ -0,0 +1,7 @@ +Embedded DigiByte Core daemon slice (M3). Forked from upstream DigiByte Core +(github.com/DigiByte-Core/digibyte). Vendoring policy: NO in-tree vendor; +reference clone built siblingly, artifacts into worktree only (M1 §1). +Scope: SPV + P2P + mempool + template builder, Scrypt-algo lane only +(project_embedded_coin_daemons_primary). Confirm DigiByte Core commit/tag at +vendoring. Non-Scrypt algo lanes (SHA256d/Skein/Qubit/Odocrypt) are NOT driven +in V36. Stub placeholder at M2. diff --git a/src/impl/dgb/test/README.txt b/src/impl/dgb/test/README.txt new file mode 100644 index 000000000..9ddf114ca --- /dev/null +++ b/src/impl/dgb/test/README.txt @@ -0,0 +1,6 @@ +DGB module tests (M3). Mirror src/impl/btc/test: template_parity_test (vs +p2pool-merged-v36 reference fixtures), share_test (Scrypt shares == LTC format). +Adds: Scrypt block-validation fixtures; multi-algo handling test (non-Scrypt +headers accepted-by-continuity, never PoW-validated, never rejected on algo); +DigiShield per-algo retarget vectors (Scrypt lane). DOGE-aux integration tests +under -DAUX_DOGE=ON are STRETCH (§X), deferred behind Phase 5.8. Stub at M2.