Repository navigation
3.x.x: pause the session load's shares around scenario 2's own blocks, and start each replayed transcript after earlier blocks land (#631, #632) - #640
Conversation
…, and start each replayed transcript after earlier blocks land (#631, #632) #631: on regtest a load share weighs about half an own block. The share-only settings' 2^-32 is the easiest share target there is, and an own block's block-only proof is credited at regtest's ~2^-31 network difficulty. So ~15 load shares fill the 8x window, and which earlier own share survives in each own block's window is a timing race. The nightly deep reorg under 2,000 sessions hit the case where branch B paid both miners exactly what branch A did. The load can now pause its share offers (sessions stay connected and keep taking work), and deep_reorg pauses them from its seed blocks until branch B's own blocks are paid, then resumes them for the heal and the reorg. Without a load the hook does nothing. #632: esp-miner-suggest-difficulty finds a block, which lands after its submit is answered. The next transcript's first share could pass its revision check before the landing and commit after it, and was refused as ledger-confirmation-failed. current() now also waits until no candidate is unfinished and /healthz payout_state_generation is the cluster's payout_revision. Closes #631, closes #632. Refs #553, #586. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Handover@kiwidream now owns this PR. It is a test-only flake fix. Head is d6c1b9f. CI is still running on the head commit. A review ledger will be posted here once CI is green. Any findings from that review will be listed in the ledger as open items with a proposed fix. No new commits will be pushed by the current owner. Left to do: green CI, the ledger, then owner review and merge. This closes #631 and #632. |
Review ledger (d6c1b9f)Two reviews ran: Confirmed sound:
Open items: three leaks in the pause barrier (low severity; each can let a stray load share into scenario 2's window on rare timing):
A tested patch implementing (a)–(c) exists (+45/−14 across Coverage note. Frontend 0's stop and the failover to frontend 1 now happen while shares are paused, so scenario 2 no longer exercises load share appends during that failover. The other nightly load cases still do. Revalidation of the patch: private PostgreSQL 16 with fsync on, pinned qbit, debug build.
Low risk, noted only:
|
|
Ledger addendum: CI on d6c1b9f is green (21 pass, 12 skipped, 0 fail). The open items (a)–(c) in the ledger above are handed to @kiwidream; no further commits from this lane. |
… sent, and on shares that commit after their answer (#631) Review follow-ups: - A session now counts itself as unanswered before it reads the pause flag. Before, a share could be mid-write when the pauser read zero. - After the answers drain, the pause also waits until the share ledger holds still for 2 s. A lost or ledger-outcome-unknown answer may still commit. - The drain allows twice the answer bound. A stuck share is cleared on the first tick past the bound, and ticks can be up to the bound apart. Refs #631, #553. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ledger update8dde4dc fixes all three open items in the review ledger above:
Revalidated before push: replay 3/3, per-PR deep reorg 1/1, nightly scenario 2 3/3, unit tests 8/8, fmt and clippy clean. Test-only change, two support files. Left to do: green CI on 8dde4dc, then owner review and merge. |
…aits on #621 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…landing cannot race the phase's first share (#656) (#659) * 3.x.x: mine each clock-jump phase on settled work, so a held block's landing cannot race the phase's first share (#656) The 10-04 nightly failed phase 3 of the wall-clock jump test. Server 0 refused the phase's first share as ledger-confirmation-failed and logged "payout revision changed before share commit" in the same second the node took the held block. held_landing returned as soon as the held block was the node's tip, and the phase mined at once, on work from before two payout-revision moves: the landing's and the servers' observation of the new tip. The share passed its submit check and met the moved revision at the append's fence (#632). Since #581 the holder lands its held block itself as soon as it is released, so phase 3 now has phase 4's shape. Phase 4's refusals were the same race (10-02 and 10-05 nightlies). The test allowed them as REFUSED_AFTER_STEP_BACK and blamed the clock stepping back. Fixture::settled is #640's wait from the transcript replay's current(), now shared. It waits until no candidate is unfinished and the server's /healthz shows the node's tip with payout_state_generation at qbit_prism_cluster.payout_revision. The replay calls it with the same conditions as before. The clock-jump test waits on it before every serving mine and before each held block, and REFUSED_AFTER_STEP_BACK is removed: phases 3 and 4 must accept every share, like every other phase. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: count a clock-jump phase's settling against its WORK_SECONDS, so waiting for settled work does not double a server's serving budget (#656) The settle wait added before each mine had its own 30 s, ahead of the 30 s work_on still gave a miner. A corrected server therefore had up to 60 s to serve again, where the test's WORK_SECONDS documents 30 s. Run::mine and held_landing now set one WORK_SECONDS deadline, settle within it and give work_on what remains. The ahead phase's no-work check keeps its own WORK_SECONDS. Fixture::settled takes its time limit, and the transcript replay passes its 30 s as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: retrigger CI after an unrelated authorization_rpc statement-timeout failure (#656) Shard 2 failed authorization_rpc's authorization_fallback_requires_a_definitive_address_result with "canceling statement due to statement timeout". That test is outside this change, and the same shard passed on 26a866f. The token cannot rerun a job, so this empty commit runs CI again. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…ettlement-lock hold cannot start ahead of the landing's revision bump (#686) (#691) faults_under_load_drain_an_offer_in_flight_and_outlast_a_settlement_lock_holder failed three times, on two PRs and one 3.x.x push. Each time every retained-work share in the first 3 s of the settlement-lock hold was refused stale-job. The sigterm-drain fault leaves its found block for the relaunched frontend to land. The landing confirms the block and bumps the payout revision, and until work at the new revision is published every share on the old work is refused stale-job. The harness started the next fault as soon as the frontend answered /healthz. When the bump came just before settlement-lock took SETTLEMENT_LOCK, the holder also blocked the republication. SigtermDrain now settles before the next fault, like the SIGKILL's landing wait and #640's gate. Once the frontend serves again, it polls the block's row until it is submitted. Then it reads qbit_prism_cluster.payout_revision and every frontend's /healthz until each one is ok, publishes payout_state_generation equal to that revision, and has delivered that work to every authorized session. The recovery window waits for the settle, bounded at 60 s, and the phase's time bound includes that wait. A new check fails the drain when it did not settle. A row that goes terminal without landing ends the wait at once, and a block the shutdown itself landed counts as landed. The evidence reports the landing and settle times and the last reading. Locally, pinned to two CPUs, the per-PR test passed 20 of 20 before and after. With the hold started 3 s earlier (baseline=0), 12 of 20 passed before, every failure with CI's message, and 20 of 20 after, with no refusal in any hold. The block landed 0.5 to 3.3 s, and every frontend's work was current 2 to 6 s, after the frontend served again. #692 tracks the same guard for the other faults that land a block. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… CI on the tag by dispatch, and the issue list at the cut From the review of #703: - A rehearsal uses both holds, as the rehearsal procedure requires: the ledger's `submission-hold set` before any frontend starts, and PRISM_BLOCK_SUBMIT_ENABLED=0 on every frontend. The notes offered them as alternatives. - ci.yml has no tag trigger, so CI on the tag is dispatched by hand. The nightly set runs on the version-bump PR and on the tag. The soak and faults-long-real-node are described as runs whose verdicts are in the bundle. - #632 is closed (fixed by #640) and leaves the known issues. #582 and #604 are added: fixed in code, open for #291's go/no-go sweep. - The production line is 2.x.x, without naming a version the 2.0.2 tip contradicts. - The development-line note gives the tree's identity as 3.0.0-rc.1 and no longer lists the closed #268 as outstanding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #631. Closes #632. Refs #553, #586.
Test-only: no server code changes. Both failures were test bugs; the diagnoses are on #631 and #632.
#631: scenario 2 under load paid its own blocks by timing
Cause. On regtest a load share weighs about half an own block:
So ~15 load shares fill the 8× window. Every own block paid most of its reward to the load's address, plus at most one earlier own share, and which one survived was a race. The nightly hit the case where branch B paid both miners exactly what branch A did.
Change.
live_session_load.rs:SessionLoad::share_pausepauses or resumes every session's share offers, andSessionLoad::answeredreports when none is still waiting for an answer.secondsandofferednow exclude pauses, and a newpaused_secondsfield records them.live_two_node.rs:LOAD_SHARES, a hook in the style ofREADY_GATE.deep_reorgpauses the load's shares from its seed blocks until branch B's own blocks are paid. It resumes them for the partition depth, the heal, the reorg reconciliation and fanout maturity, so the reorg itself still runs under the whole load. Without a load the hook does nothing, so the per-PR case is unchanged. The precondition's message now prints branch A's balances.live_chain_events_load.rs: the scenario-2 load case installs the hook.#632: transcript replay started before the previous block landed
Cause.
esp-miner-suggest-difficultyfinds a block, and the block lands after its submit is answered.current()waited only forobserved_tipto equal the node's tip, which still held the old tip. The next transcript's share could pass its revision check before the landing and commit after it, and was then refused asledger-confirmation-failed. #625 changes only admission order, so this is not a regression from it.Change.
current()also waits until no candidate is unfinished (CandidateState::UNFINISHED_SQL) and/healthzpayout_state_generationequalsqbit_prism_cluster.payout_revision.Evidence (local: private PostgreSQL 16 with fsync on, pinned qbit, debug)
ledger-confirmation-failedonnicehash-extranonce-subscribeid 5). The fixed replay passed 2 of 2.real_deep_reorg_…: 2 of 2session_loadunit tests: 8 of 8cargo fmt --checkandclippy -D warningsonlive_regtest: cleanNo new tests, so
test/prism-gated-tests.txtis unchanged.Follow-up suggestion (#621's thread): the pre-insert revision refusal writes nothing and could answer
stale-jobinstead ofledger-confirmation-failed.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Coverage note: frontend 0's stop and the failover to frontend 1 now happen while load shares are paused, so scenario 2 no longer exercises load share appends during that failover. The other nightly cases still do.