Skip to content

dgb: rewire ShareTracker::score onto coin/ tail_score SSOT (#411 follow-on) - #504

Merged
frstrtr merged 1 commit into
masterfrom
dgb/tail-score-prod-rewire-411
Jun 25, 2026
Merged

dgb: rewire ShareTracker::score onto coin/ tail_score SSOT (#411 follow-on)#504
frstrtr merged 1 commit into
masterfrom
dgb/tail-score-prod-rewire-411

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 25, 2026

Copy link
Copy Markdown
Owner

dgb: rewire ShareTracker::score onto coin/ tail_score SSOT (#411 follow-on)

Production byte-identical delegation of the six pure-arithmetic sites in
ShareTracker::score() onto the KAT-pinned coin/tail_score_endpoints.hpp
SSOT (landed header-only in #411). The chain walk stays inside the member
(it needs the verified skip-list / TrackerView); only the integer
endpoint/guard/span arithmetic is delegated:

  • short-chain guard -> score_head_too_short
  • 15/16 endpoint offset -> score_endpoint_offset
  • /16 tail walk count -> score_tail_walk_count
  • unresolved-block span -> score_resolved_block_span
  • span clamp -> score_time_span
  • work/span divide -> score_value

Value-identical (same int32_t span type, same uint288 divide); chain_length
is a positive net constant so signed/unsigned (CL*15)/16 and CL/16 coincide.
Diagnostic tail-ranking arithmetic, fenced to src/impl/dgb/, no consensus
value semantics changed. Closes the #411 SSOT drift-risk (header was not
yet referenced by the live score path).

dgb_share_test 34/34; dgb_tail_score_endpoints_test 8/8.

…ow-on)

Production byte-identical delegation of the six pure-arithmetic sites in
ShareTracker::score() onto the KAT-pinned coin/tail_score_endpoints.hpp
SSOT (landed header-only in #411). The chain walk stays inside the member
(it needs the verified skip-list / TrackerView); only the integer
endpoint/guard/span arithmetic is delegated:

  - short-chain guard      -> score_head_too_short
  - 15/16 endpoint offset  -> score_endpoint_offset
  - /16 tail walk count    -> score_tail_walk_count
  - unresolved-block span  -> score_resolved_block_span
  - span clamp             -> score_time_span
  - work/span divide       -> score_value

Value-identical (same int32_t span type, same uint288 divide); chain_length
is a positive net constant so signed/unsigned (CL*15)/16 and CL/16 coincide.
Diagnostic tail-ranking arithmetic, fenced to src/impl/dgb/, no consensus
value semantics changed. Closes the #411 SSOT drift-risk (header was not
yet referenced by the live score path).

dgb_share_test 34/34; dgb_tail_score_endpoints_test 8/8.
@frstrtr
frstrtr force-pushed the dgb/tail-score-prod-rewire-411 branch from a70620e to ec12d70 Compare June 25, 2026 22:02
@frstrtr
frstrtr merged commit a3599bb into master Jun 25, 2026
33 checks passed
frstrtr pushed a commit that referenced this pull request Jul 14, 2026
…n hardening)

Clears the 8 real CodeQL security alerts on frstrtr/c2pool. Triaged +
independently re-reviewed: 1 CRITICAL is a genuine fix, 2 HIGH get
defense-in-depth, 5 HIGH are getenv-rooted false positives (dismissed
separately with justification).

- #490 CRITICAL cpp/potentially-dangerous-function (src/core/log.cpp:163):
  std::gmtime returns a pointer into a shared static tm and is not
  reentrant. Replace with gmtime_r (POSIX) / gmtime_s (MSVC) into a local
  tm. Only gmtime/localtime call in src/.

- #502/#503 HIGH cpp/path-injection (coin_peer_manager.hpp db_path()):
  m_symbol is a hardcoded ticker literal at every production ctor site
  (traced through all callers; no network->filename path exists), but
  add an alphanumeric-only guard so a future caller cannot inject a path
  component. Legitimate tickers (LTC/DOGE/DGB/DASH/BTC/NMC/...) are all
  alnum -> no on-disk filename change.

- Rider: core::filesystem::config_path() dereferenced getenv() without a
  null check -> std::filesystem::path(nullptr) is UB if HOME/APPDATA is
  unset. Fall back to '.'.

The other 5 path-injection alerts (#507 node.cpp:2199, #506/#505/#504
payout_manager.cpp:224/261/284, #501 auto_ratchet.hpp:309) all build a
path from config_path() (getenv HOME/APPDATA) + a hardcoded basename,
never from network/peer/miner input -> dismissed as false positive.
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