Skip to content

dgb: M3 §7b Scrypt-only multi-algo version classifier - #152

Merged
frstrtr merged 1 commit into
masterfrom
dgb/m3-scrypt-algo-classifier
Jun 18, 2026
Merged

dgb: M3 §7b Scrypt-only multi-algo version classifier#152
frstrtr merged 1 commit into
masterfrom
dgb/m3-scrypt-algo-classifier

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner

What

First slice of M3 §7b (SCRYPT-ONLY VALIDATION). Adds the consensus-exact DGB multi-algo block-version classifier that the deferred coin/header_chain.hpp validate() + DigiShield Scrypt-only window walk both depend on.

  • coin/dgb_block_algo.hpp (header-only SSOT): DgbAlgo, dgb_block_algo(), is_scrypt_header(), dgb_header_disposition() (three-way: VALIDATE_SCRYPT / ACCEPT_BY_CONTINUITY / REJECT).
  • Constants pinned verbatim from DigiByte Core src/primitives/block.h (BLOCK_VERSION_*, ALGO_*) + block.cpp::GetAlgo().
  • test/algo_select_test.cpp: 6-test standalone guard (GTest-only, links no OBJECT lib), wired into BOTH the ctest foreach allowlist AND both build.yml --target lists (per the ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT lesson).

Consensus notes

  • CRITICAL: Scrypt == (0 << 8) — masked algo bits are ZERO. Gate is (nVersion & 0x0F00) == 0, not a nonzero check. Test asserts this directly (a bare primary-version header is Scrypt).
  • Pins upstream quirk ALGO_ODO == 7 (not a dense 5); reserved codepoints (10/12 << 8 = Equihash/Ethash) decode to UNKNOWN -> REJECT.
  • Honors the §7b work-neutrality invariant at the routing layer: non-Scrypt headers route to ACCEPT_BY_CONTINUITY, never the Scrypt PoW lane.
  • No p2pool-merged-v36 divergence: embedded-daemon-internal, below the share layer.

Verify

build EXIT=0, algo_select_test 6/6 PASS locally. No header_chain.hpp/transport touched.

HOLD merge — operator push-approval card as usual.

DigiByte encodes the mining algo in 4 bits of the block nVersion field. The
Scrypt-only V36 validation path needs a consensus-exact decode to route each
incoming parent header: Scrypt -> PoW-validate, known non-Scrypt ->
accept-by-continuity (work-neutral), unknown algo bits -> reject.

Add coin/dgb_block_algo.hpp: a header-only SSOT (DgbAlgo, is_scrypt_header,
dgb_header_disposition) pinning the BLOCK_VERSION_* / ALGO_* enums verbatim
from DigiByte Core src/primitives/block.h + GetAlgo(). CRITICAL invariant:
Scrypt == (0 << 8) -- the masked algo bits are ZERO -- so the gate is
(nVersion & 0x0F00) == 0, not a nonzero check. Also pins the upstream quirk
ALGO_ODO == 7 (not a dense 5) and rejects reserved codepoints (10/12 << 8).

Add standalone guard test/algo_select_test.cpp (6 tests, GTest-only, no
OBJECT lib) and register it in BOTH the ctest foreach allowlist and the two
build.yml --target lists, per the #143 NOT_BUILT lesson. No header_chain or
transport wiring touched; foundational primitive for the deferred
validate()/DigiShield-window port.
@frstrtr
frstrtr merged commit 064a717 into master Jun 18, 2026
16 checks passed
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