Repository navigation
3.x.x: async promotion with live miners: account for every offered, ACKed, rejected and unknown share, keep sessions and work, and land a block on the promoted ledger (#474) - #620
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 159662e1a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
31e1230 to
d465bf1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d465bf1603
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d465bf1 to
aa47442
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa4744298e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
aa47442 to
4df2b9b
Compare
5fa5606 to
2564cc0
Compare
9bb1f40 to
56fc8d6
Compare
b3fbc76 to
d368201
Compare
a0e5d10 to
c7fe25e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7fe25ec6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f250c2c to
346352b
Compare
c7fe25e to
19843a7
Compare
346352b to
61a40f2
Compare
8fe260e to
3072b85
Compare
61a40f2 to
9920be5
Compare
3072b85 to
a80b06c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a80b06c87b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
9920be5 to
381bebb
Compare
bdae02c to
ebf35df
Compare
f37763f to
d9bf601
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9bf601088
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
46ca90d to
5c17d2a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c17d2ad2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 417be0870b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f44aa13 to
bfa72e0
Compare
…CKed, rejected and unknown share, keep sessions and work, and land a block on the promoted ledger (#474) #474 slice B, a child of live_pg_failover.rs on its D3 pair and relays. Four scripted Stratum miners, each with its own payout address, submit shares on two real frontends through a replication cut and a writer fence, with a share COMMIT held in flight at the fence by a deferred trigger. Every submission is recorded by identity and reconciled with the old and promoted ledgers: each ACK was committed, each ACKed-but-missing share is named and inside the gap, no definite rejection was committed, and the old writer committed nothing after the fence but the COMMITs it held. After the promotion the same sessions submit new shares, kept work from before the cut and from a job issued in the gap, the lost ACKed shares again and a surviving one again (a duplicate); a block on post-promotion work lands and its audit, verified against the coinbase, is a full read of the promoted window, including sequence numbers the lost shares held. A block on the gap-issued job is offered and put on chain but never lands (#619); its assertion is an opt-in #[ignore]d test until #619 is fixed. ShareClient gains solve/submit_solved so a miner can keep work. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… promotion case (#474) Each miner keeps one share of work on its first iteration before the cut and in the gap. Nothing waited for it, so a miner that scheduling skipped in a phase left the replay checking less than the case states. The phase transitions now wait, inside their existing bounded conditions, until every miner has kept work for the phase, and the replay asserts exactly one kept share per miner per phase before consuming them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ued after the promotion (#474) The first post-promotion submissions use each session's current job, which may predate the cut: frontends push no new work until the tip moves. Name them so, and add the missing proof: once the final block moves the tip, every surviving session is notified of work for it and a share on that work is accepted and credited exactly once. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the tip (#474) In the opt-in #619 case the gap-issued block was submitted after the final block had advanced the tip, so the stale-parent rule could refuse it and the reproducer pass without exercising #619. It is now submitted right after the kept work, on the tip its job builds on; locally it is accepted, offered and stuck in reconciliation, as #619 describes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, now that #645 refuses it (#474) #645 fixed #619 on 3.x.x: a block on work from a lost replication gap is refused as stale-job before its offer. The opt-in reproducer issue_619_gap_issued_block_after_async_promotion_is_refused_or_pays_only_promoted_rows passes on the rebased branch, and it asserts everything the gated drill does plus that refusal. So the gated drill now submits the block it solved on the gap-issued job, and the ignored copy and the GapBlock switch are gone. The comments that described #619 as open now describe #645's behaviour, and the scenario note and #645's design note name the gated drill instead of the removed reproducer. Locally against PostgreSQL 16 and the pinned qbit 1.0.0, the drill passed 15 of 15 runs; each time the gap-issued block was refused as stale-job and no session was replaced for a stale window. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bfa72e0 to
29e45de
Compare
|
Taking this over per #626.
Next: 🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29e45de7e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…he surviving share before any block moves the tip (#474) Codex: when the gap-issued block was refused, nothing checked that its share was not credited. It was not added to the answers the drill holds to the promoted ledger, so a regression that credited the block as an ordinary share while refusing its payout authority would have passed. It is now one of those answers: landed, it must be credited once; refused, not at all. #645's own gated test asserts the same without qbitd. /code-review high: the surviving acknowledged share was replayed after the final block had moved the tip, and was required to read `duplicate-share`. The server settles a stale parent, with its 3 s grace, before it looks for a duplicate. So once the replays of the lost shares outlasted the grace, the same replay would have read `stale-job` on a correct server. It is now replayed right after the kept work, while its parent is still the tip. The review's other findings are test robustness and cleanup, and are deferred to #697. Locally against PostgreSQL 16 and the pinned qbit 1.0.0, the drill passed 8 of 8 runs with both changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
P2 verify the rejected gap block was not credited. Fixed. The gap-issued block's submission now joins the answers the drill holds to the promoted ledger ( From The review's other seven findings are test robustness and cleanup: replay coverage, failure-path cleanup of the advisory-lock hold and the miner tasks, Local runs on 🤖 Generated with Claude Code |
Refs #474 (slice B). Test-only: no production code changes. It found #619, which #645 has since fixed. Follow-ups: #697.
What this adds
pg_failover_tests::async_live_miners::async_promotion_with_live_miners_accounts_for_every_share_and_lands_a_blockis a child oflive_pg_failover.rs. It reuses that module's D3 pair (PostgreSQL 16 primary plus one physical async standby), the stable writer endpoint relay, the replication relay and the promotion procedure. It runs two real native frontends and a real qbitd.ShareClient) run on both frontends, each with its own payout address. They submit shares continuously before the replication cut, through the gap and across the fence. Every submission is recorded by identity together with the answer the miner received: acknowledged, rejected with a reason, or unknown (no answer, a lost connection, orledger-outcome-unknown).stale-job/unknown-job.duplicate-share.stale-job/unknown-jobwith its share uncredited, or land paying only rows the promoted ledger holds. Since 3.x.x: refuse a block on work from a lost replication gap before its offer, and stop issuing that work after an async promotion (#619) #645 it is refused before its offer.stale-joband not credited.This cites, and does not duplicate, #466's
ledger/window/snapshot_delta/tests/physical_failover.rs::physical_async_failover_replaced_history_matches_full_read.ShareClientgainssolveandsubmit_solved, so a miner can keep solved work and submit it later;submitis unchanged.What the test found: #619
A block solved on the gap-issued job and submitted after the promotion is accepted by the frontend. It is offered, and qbitd puts it on the active chain with a coinbase paying the lost window. Landing then fails permanently with
window range incomplete: expected 15 shares, read 0. The candidate stays inreconciliationunder an ERROR ALERT, with noqbit_pool_blocksrow and no audit.Until #619 was fixed, the gated test kept that block unsubmitted and an
#[ignore]d reproducer asserted the desired behaviour. #645 fixed it on3.x.x: the block is refused asstale-job(window_not_held) before its offer. The reproducer passed on the rebased branch, so it is folded into the gated test, which now submits the block.A sample run
These are the counts from one run:
backend-rpc-unavailableafter the fence, 3ledger-confirmation-failedqueued behind the held COMMIT and truthfully never committed) and 1 unknown (the held COMMIT, which completed on the old primary and was lost in the gap).Placement and runtime
The test runs per PR: it is added to
test/prism-gated-tests.txt, andr474-b-async-promotion-under-live-minersis nowruns = true. It is cheap, about 7.5 s including the cluster pair.Verified locally
The environment was PostgreSQL 16 binaries (
PRISM_TEST_PG_BIN_DIR=/usr/lib/postgresql/16/bin) with the pinned qbit 1.0.0.cargo test -p qbit-prism-server --test live_regtest async_live_miners -- --nocapturepassed 30 of 30 on the final revision, each finishing in 7.3–9.4 s. Failures on earlier revisions were 3.x.x: after an async promotion, a block on a job issued in the replication gap is offered and lands on chain but can never be landed in the pool (window range incomplete) #619's second mode, locally and once in CI; it is now guarded as described above.cargo test … issue_619 -- --ignored --nocapturefailed as expected in 3 of 3 runs.3.x.xc95febb3, with 3.x.x: refuse a block on work from a lost replication gap before its offer, and stop issuing that work after an async promotion (#619) #645. The local environment was PostgreSQL 16.10 and the pinned qbit 1.0.0.stale-jobevery time; 8 of them were on the final head159f2f64.29e45de7.cargo clippy -p qbit-prism-server --test live_regtest -- -D warningsandcargo fmt --all -- --checkare clean.python3 scripts/check_e2e_scenarios.pypasses, andpython3 -m unittest tests.test_check_e2e_scenarios tests.test_check_gate_manifest tests.test_check_gate_env_readsis OK.Not covered here
🤖 Generated with Claude Code