Repository navigation
3.x.x: cap a block proof's acknowledgement wait at the share commit timeout instead of 60 s (#574) - #577
Merged
Conversation
…imeout instead of 60 s (#574) A captured (#478) block proof's share is deferred to its block's landing, and its Stratum answer waited for this frontend's own landing for up to block_only_ack_timeout = max(share_commit_timeout, 60 s). The miner's session can submit nothing else meanwhile, and some firmware or rental marketplaces treat a long silence as a dead pool (#562 measured 16.6 s with 8 s of landing delay). - block_only_ack_timeout is now share_commit_timeout itself (15 s by default), derived by config::block_only_ack_timeout, which from_env and the new test share. It still bounds every block-bearing submission: a block-only, deferred or captured proof's wait for its enqueue and landing, and a share-pass append that carries the block. - At the cap the proof gets the reply every share still pending at its deadline gets: Stratum error 20, "share outcome is not yet known", reason_id ledger-outcome-unknown. Only the wait ends there: the append or landing runs on, the block is offered and landed, and the share is credited once when that commits. - The existing unknown-outcome WARN, which already names the block hash, share id and phase, now carries elapsed_ms. - New counter qbit_prism_block_proof_ack_capped_total{path=share|block_only}, both series zero at start. No new alert: the reply already counts in qbit_prism_rejections_total{reason_id="ledger-outcome-unknown"}, which PrismShareAppendFailures warns on; the counter says why. - A candidate probe that runs out the bound before the enqueue is still a definite ledger-confirmation-failed and is not counted; the pool's own 15 s acquire timeout already ended it at about the same time before. - live_regtest's failover waits from #562 are unchanged: they count credits, which still follow the landing; only their comment changes. Tests (gated, listed in test/prism-gated-tests.txt), in b574_ack_cap: a one-shot trigger holds the block's write until the test releases it (a captured proof at its offered record; a block-carrying share-pass append at its candidate insert). Each proof is answered at the 3 s cap with the pending-outcome reply while the write is held, uncredited, and counted once on its path; after the release the share is credited exactly once and the block lands. Mutants: restoring the 60 s floor in config::block_only_ack_timeout fails both at the cap; dropping the counter fails both. Closes #574 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e, and give a block-carrying append the share grace (#574 review) From the #577 review lanes: - Block loss (adversarial lane). persist_block_only ran its duplicate probe under the acknowledgement bound, so once #574 shortened the bound to share_commit_timeout, a probe queued on a saturated pool or a slow leaf could run out the bound. The proof was then answered ledger-confirmation-failed with nothing enqueued, and the found block was never offered. The probe and the enqueue now run in one spawned task that neither the bound nor a cancelled submission stops. Only the wait for it is bounded: past the bound the proof is answered ledger-outcome-unknown, counted as capped, and the task is followed until the block reaches the outbox. A probe error is still a definite failure with its database error intact (EnqueueStep::ProbeFailed). - Grace (all three lanes, coordinator decision A). A share-pass append that carries a found block now follows a plain share's ladder: the share deadline, plus share_commit_grace once COMMIT is in flight. It is never refused, so it runs on past an unknown answer. Before, #574 gave it 15 s with no grace, less than a plain share. block_only_ack_timeout now bounds only block-only proofs (captured, deferred, below-target), which stay capped at share_commit_timeout exactly. - Audit of the block path after the acknowledgement clock starts: - the block-carrying append already ran in a task the answer does not abort; - the probe and enqueue now do too; - the disposition poll only reads; - the landing runs in the candidate loop. Nothing on the path is cancelled by the bound any more. - Docs: the metrics guide no longer describes late block-carrying confirmations past a block-only bound; the counter's help and status describe both bounds. live_regtest's allowance is renamed landing_credit_seconds. Tests: - b574_ack_cap gains two gated tests: - a captured proof whose pre-enqueue probe is held past the cap is answered unknown at the cap and counted, and its block is enqueued after the release, lands, and credits the share once; - a block-carrying append held inside COMMIT past the deadline is accepted within the grace and counted as a late confirmation, not as capped. - The answer-time slack is now 2 s, below the 5 s grace. - Updated for the new contract: - commit_reconcile_candidate_bearing_append_is_never_refused: accepted within the grace while COMMIT is in flight; answered at the share deadline, not the block-only bound, while held before COMMIT; - the block-only acquire tests: a cancelled or bounded probe keeps waiting instead of failing, and the block still reaches the outbox. Mutants, each failing at least one test: - the probe bounded again: ledger-confirmation-failed, block never enqueued; - no grace for a committing block-carrying append; - grace for every block-carrying append; - the 60 s floor; - the counter dropped. Refs #574 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…574 review) The block-only proof's duplicate probe now takes its pool checkout inside the spawned probe-and-enqueue task (ledger.acquire()) instead of on the coordinator (self.ledger.acquire()). Split the persist_block_only census entry accordingly; both stay delegated to Ledger::acquire, which meters the checkout. Refs #574 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
Deep-review ledgerStakes: standard. No credit, payout or settlement logic changed. The PR changes the ack wait bound, the structure of the block-path tasks and one counter. Lanes:
The cross-provider adversarial lane was not run: this work is limited to Claude models. Head: 78b93a6. Every CI check is green, and no bot or human review comments are open.
Audit of the block path after the acknowledgement clock starts:
Nothing on the path can be cancelled by the bound. |
djh58
added a commit
that referenced
this pull request
Sep 29, 2026
…s, and a per-PR Stratum transcript replay (#575) (#586) * 3.x.x: nightly e2e for PostgreSQL disk exhaustion and wall-clock jumps, and a per-PR Stratum transcript replay (#575) Three live_regtest scenarios for #575's item 5 and the automatable half of item 3. Disk exhaustion (nightly): the test's own PostgreSQL 16 keeps its whole data directory on a small ext4 image mounted with fuse2fs through the setuid fusermount helper, so no root is needed. Clients mine shares that are not blocks on both servers while a ballast fills the filesystem to ENOSPC, mine through the full state past the paging rules' `for`, then the space is freed. It asserts that every acknowledged share is in the ledger, that refusals are explicit (some with the reasons PrismShareAppendFailures counts) and no ledger-confirmation-failed share is credited, that a paging rule's condition (mirrored from docs/prism-native-alert-rules.json) holds for its `for` on every server, and that both original server processes accept shares again, land a block and keep carry integrity once space is freed. The fill/release mechanism is a reusable DiskFullInjector for #554. Clock jumps (nightly): both servers and a private PostgreSQL run under libfaketime (realtime only). Each server jumps minutes and hours behind and ahead; the database jumps two hours ahead and back while a found block's submitblock is held mid-landing. It asserts that every acknowledged share is credited once with a monotonic ledger clock, that every block is offered exactly once, lands once and matches its audit bundle, and carry integrity. A held block's answer may be ledger-outcome-unknown at the share commit timeout (#577); it must still land and be credited once. A server more than PRISM_TEMPLATE_MAX_AGE_SECONDS ahead of the node serves no work (fail-safe) and PrismWorkRefreshStalledCritical fires; corrected, it serves again. One outbox row is left in reconciliation after the database clock steps back, which #581 tracks and the test pins. Transcript replay (per PR, about 4 s): a JSON-lines Stratum transcript format and harness that replays recorded client sessions against a live server and checks each answer for compatibility, with a synthetic corpus for cgminer, bmminer version rolling, NiceHash extranonce.subscribe, Braiins mining.configure extensions and esp-miner suggest_difficulty. The nightly job installs fuse2fs, fuse3, faketime and libfaketime, and the three tests are named in test/e2e-scenarios.toml (#543). Refs #575, #554 Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: #575 e2e review fixes: every clock-jump share must be accepted, bounded disk-full phases, one Stratum session Review follow-ups on the #575 scenarios; tests only. - Clock jumps: every ordinary share a serving server mines must be accepted. Before, only the block was checked, so a server refusing every share after a clock step still passed. The one exception is the phase right after the database clock steps back, where the stale-job and ledger-confirmation-failed refusals #581 records are allowed. - Clock jumps: each block's outbox row is given its reconciliation retry (10 s per attempt) to finish before it is checked. The nightly dispatch on this branch caught a row released into reconciliation by a post-offer step that lost a payout-revision race, checked mid-backoff. - Disk exhaustion: every phase is bounded (a server that never accepts fails the test instead of hanging the job), and the full state ends when a paging rule has fired on each server, bounded, instead of a fixed 200 s after the first refusal of either server. - One StratumSession serves both the share client and the transcript replay; answers are typed (accepted, rejected, timed out, lost) instead of matched on error text. - Rule mirrors, the sliding [5m] window and the `for` verdicts live in the alert-rules module; the submitblock proxy and the host-tool helpers get their own support files; impossible states are gone from the types. Refs #575, #554 Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Caps a captured or block-only proof's acknowledgement wait at
share_commit_timeout(15 s by default) instead ofmax(share_commit_timeout, 60 s). A captured (#478) proof's miner no longer sits silent for up to a minute while its frontend lands the block. The bound only ends the wait: no step that offers the block or credits the share can be cancelled by it.Change
block_only_ack_timeoutis nowshare_commit_timeoutitself. It comes fromconfig::block_only_ack_timeout, which bothConfig::from_envand the tests call. It bounds a captured, deferred or below-target block proof's wait for its enqueue and landing.share_commit_graceonce COMMIT is in flight. They are never refused, so they run on past an unknown answer. A found block is never served worse than a plain share.ledger-confirmation-failedwith nothing enqueued, so the block was lost. A probe error is still a definite failure.20, message "share outcome is not yet known",reason_idledger-outcome-unknown. Only the wait ends there. The append or landing runs on, the block is offered and landed, and the share is credited once when that commits.share outcome unknown at the acknowledgement deadlinealready names the block hash, share id and phase. It now addselapsed_ms.qbit_prism_block_proof_ack_capped_total{path}, withpath=shareorblock_only. Both series start at zero. It is in the registry, census, contract test, metadata and generated inventory.qbit_prism_rejections_total{reason_id="ledger-outcome-unknown"}, whichPrismShareAppendFailureswarns on; the counter says why.Operator impact
20,ledger-outcome-unknown) after 15 s instead of 60 s. Some miner UIs and rental marketplaces count that as a reject, although the share is credited later, once the landing commits. Before this change, the same proof was either accepted after up to 60 s of silence or got the same error at 60 s.PrismShareAppendFailurescan now fire on a slow landing alone. It warns (never pages) when anyledger-confirmation-failedorledger-outcome-unknownrejection occurred in the last 5 minutes, held for 3 minutes. A captured or block-carrying proof whose landing or append takes more than 15 s is enough, where before it needed more than 60 s. Expect at most about one warning per found block while landings are slower than 15 s: one captured proof per affected session per block, as the issue measured. Every such rejection is also counted inqbit_prism_block_proof_ack_capped_total. To keep the warning for real append failures only, ops can subtract that counter'sincreasefrom the rule's. This PR does not change the rule.ORDER_LOCK, which is tracked separately. This PR only bounds how long a miner waits for one.Worth a reviewer's look
block_only_initial_probe_sql_error_cancel_and_original_deadline,clock_and_block_only_duplicate_checkouts_are_lazy_and_cancel_once). The block now reaches the outbox anyway, and the pool-checkout accounting records the probe's checkout when it succeeds rather than a cancellation failure.block_only_ack_timeoutis now redundant withshare_commit_timeout. Removing the field touches about 13 test fixtures owned by other lanes, so it is left for a follow-up issue.Tests
The new binary
b574_ack_capholds four gated tests, listed intest/prism-gated-tests.txt. Both frontends take the block-only bound fromconfig::block_only_ack_timeoutwith a 3 s share commit timeout. A one-shot trigger or function holds one database step until the test releases it. "Answered at the cap" means the answer came between 3 s and 5 s (2 s of slack, below the 5 s grace), with reply20/ledger-outcome-unknown.a_captured_proof_is_answered_at_the_cap_and_credited_after_its_landingoffer_reserved→offeredrecord, after the node accepted the blockpath="block_only"= 1submitted; the deferred share is credited exactly oncea_captured_proof_whose_probe_outlasts_the_cap_is_still_enqueued_and_creditedpath="block_only"= 1a_block_carrying_share_append_is_answered_at_the_cap_and_credited_oncepath="share"= 1a_block_carrying_append_whose_commit_is_in_flight_gets_the_share_graceMutants (each fails at least one test):
ledger-confirmation-failed, and the block is never enqueued.Other runs (private PostgreSQL 16, fsync on):
observabilitybinary passes (the census grows by 1 family and 2 series).live_regtest::real_two_server_mining_failover_audit_and_reorgpasses 5 of 5 (125 s, 7 s, 7 s before the review fixes; 7 s, 6 s after). The 125 s run waited out a landing claim inquiesce, as noted in 3.x.x: bound the failover test's share and subscribe waits by the server's own answer bounds (#562) #572. Its 3.x.x: after one frontend is killed mid-landing, the surviving frontend can stop answering shares for 20+ s #562 waits count credits, which still follow the landing, so their bounds stay unchanged; only the comment changes.CI runtime added: about 20 s, for the one new binary with four tests of about 4 s each plus fixture setup.
Checks
cargo clippy --locked -p qbit-prism-server --lib --tests -- -D warnings: clean.cargo fmt --all --check: clean.python3 scripts/generate_prism_metrics.py: regenerated.Closes #574
🤖 Generated with Claude Code