Skip to content

dgb/doge DC: single-fire broadcast-path proof (election + idempotent ledger) - #502

Merged
frstrtr merged 1 commit into
masterfrom
dgb/doge-dc-single-fire-proof
Jun 25, 2026
Merged

dgb/doge DC: single-fire broadcast-path proof (election + idempotent ledger)#502
frstrtr merged 1 commit into
masterfrom
dgb/doge-dc-single-fire-proof

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Fenced phase-DC proof artifact for the integrator HARD precondition (UID2478): the submitauxblock RPC fallback cannot double-fire the same DOGE block hash alongside the embedded submit path.

coin/aux_broadcast_path_election.hpp (pure; links only core/uint256 + ; consumes nothing in src/impl/doge; no node seam touched):

  • elect_aux_broadcast_path() — total fn, exactly ONE carrier per won block. Embedded submit_block PRIMARY; RPC submitauxblock FALLBACK only when no embedded relay. Mirrors aux_chain_embedded.hpp roles; structurally cannot return both.
  • AuxBroadcastLedger::try_fire() — idempotent guard keyed on DOGE block hash; one authorization per distinct hash, every later attempt suppressed regardless of path.
  • elect_and_claim() — election + ledger composed; single-fire end to end.

dgb_aux_broadcast_path_election_test — 10/10 green: exhaustive 2x2x2 election truth table (never both / embedded-primary), ledger fresh-then-suppressed + distinct-hash independence, and the integrator both-paths-same-hash scenario fires once (order-independent) + no-win does not burn the hash.

Registered in test/CMakeLists.txt AND both build.yml --target allowlist lines (#143 NOT_BUILT guard). FENCED, no consensus surface. NO self-merge.

…ledger)

Fenced phase-DC proof artifact satisfying the integrator HARD precondition
for any DC live-wire: the submitauxblock RPC fallback cannot double-fire the
same DOGE block hash alongside the embedded submit path.

coin/aux_broadcast_path_election.hpp (pure, links only core/uint256 + <set>):
  - elect_aux_broadcast_path(): total fn, returns exactly ONE carrier per won
    block. Embedded submit_block PRIMARY; RPC submitauxblock FALLBACK only when
    no embedded relay. Mirrors aux_chain_embedded.hpp documented method roles.
    Structurally cannot return "both".
  - AuxBroadcastLedger::try_fire(): idempotent guard keyed on DOGE block hash;
    true exactly once per distinct hash, every later attempt suppressed
    regardless of path -> single broadcast across retries / both-paths race.
  - elect_and_claim(): election + ledger composed; single-fire end to end.

dgb_aux_broadcast_path_election_test (10/10): exhaustive 2x2x2 election truth
table (never both, embedded-primary), ledger first-fresh/second-suppressed +
distinct-hash independence, and the integrator scenario both-paths-same-hash
fires once (order-independent) + no-win does not burn the hash.

Consumes nothing in src/impl/doge; touches no node seam (live DC wiring stays
parked). Registered in test/CMakeLists.txt AND both build.yml --target
allowlist lines (#143 NOT_BUILT guard).
@frstrtr
frstrtr merged commit e7bf7d1 into master Jun 25, 2026
42 of 43 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