dgb: rewire ShareTracker::score onto coin/ tail_score SSOT (#411 follow-on) - #504
Merged
Conversation
…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
force-pushed
the
dgb/tail-score-prod-rewire-411
branch
from
June 25, 2026 22:02
a70620e to
ec12d70
Compare
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.
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.
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:
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.