Repository navigation
3.1 dual-writer (3/5): carry owner and peer settlement - #767
Conversation
8919a2b to
d04cdc4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93d901ae0a
ℹ️ 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".
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. |
93d901a to
cae3115
Compare
This comment has been minimized.
This comment has been minimized.
7769999 to
ef4391a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cae3115394
ℹ️ 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".
…row; classify the carry owner's checkout sites From Codex's review of cae3115 (PR #767): the guard took only the newest of the peer's live and synced rows, so a peer whose database was rolled back to an older claim, behind the release this node's copy holds, could act on that claim while this node kept paying. The guard is now carry-free on any live claim of the peer's, as transfer already refuses one. The pool-acquire census (scripts/check_prism_pool_acquires.py): - the guard and the carry-owner commands check out through Ledger::acquire; - the journal helpers run SQL on the caller's connection (&mut *connection); - the peer reads through PeerJournal get their own policy, peer-journal; - the remaining carry-owner, fanout, adoption and guard-spawn sites are classified. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…row; classify the carry owner's checkout sites From Codex's review of cae3115 (PR #767): the guard took only the newest of the peer's live and synced rows, so a peer whose database was rolled back to an older claim, behind the release this node's copy holds, could act on that claim while this node kept paying. The guard is now carry-free on any live claim of the peer's, as transfer already refuses one. The pool-acquire census (scripts/check_prism_pool_acquires.py): - the guard and the carry-owner commands check out through Ledger::acquire; - the journal helpers run SQL on the caller's connection (&mut *connection); - the peer reads through PeerJournal get their own policy, peer-journal; - the remaining carry-owner, fanout, adoption and guard-spawn sites are classified. Co-Authored-By: Claude Opus 5.5 <[email protected]>
359539d to
7a2ea81
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a2ea81b80
ℹ️ 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".
…t; let transfer recognize earlier pool markers From Codex's review of 7a2ea81 (PR #767): - transfer read the peer's latest rows and its latest claim in two reads, which a primary and a lagging fallback URL could answer differently; a missing claim then left the scan unbounded. PeerJournal::view reads both in one REPEATABLE READ snapshot on one connection, and scan_start refuses a peer that released when no claim of its can be read. - The chain scan recognized pool blocks by the current coinbase tag and pool-fee program only. carry-owner transfer takes the earlier ones (--also-tag, --also-fee-program, repeatable), and the ops doc says when to pass them, and that S8 adoption recognizes only the current ones. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a06a8b7bb
ℹ️ 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: 476fdd9950
ℹ️ 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".
The final round's merge of the stack below: D3's 476fdd9 (#767), with D2's 5e7eac6 and D1's 036d449 in it. One conflict, by hand: server.rs's comment on the tasks that wait for the own-log latch keeps D3's adoption beside this branch's listeners, which wait through admission. The pool checkout census, the metrics inventory and the gated list merged clean. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d9d9dde22
ℹ️ 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".
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 835963e0fe
ℹ️ 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: fa9ca5383f
ℹ️ 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: a7acc0424b
ℹ️ 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: 1aba7413aa
ℹ️ 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".
The final round's catch-up merge: D3's 61eacad (#767, Codex-approved), eight commits past 476fdd9. No conflicts; the pool checkout census and the metrics inventory still match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
CI on b38fba8: one known flake, unrelated to this PR.
Our token cannot rerun Actions jobs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c8c72b6da
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6264cd4f27
ℹ️ 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: 4d8897c099
ℹ️ 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: a7ce81ec5e
ℹ️ 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".
…e token renewal Codex P1 on 0d9d9dd. The reservation decides whether carry-paying work is current, but submit_block comes after the found-block wait (up to PRISM_PEER_INGEST_WAIT_MS) and the token renewal. A gate that moved in that interval let a block reserved as current be sent while the peer might also pay carry. Right after the strictly-live renewal, immediately before the send, the offer now rechecks the gate in memory. A block reserved as current whose work is carry-paying is not sent if the gate is now closed or unfenced, or has changed at all since the reservation. That includes a gate closed and reopened meanwhile, since the peer may have paid the same balances while it was closed; the gate now counts its changes for this check. Its reservation returns to pending through release_unmade_offer, the #522 release for a call never made. It is due again at once rather than after the pending backoff, and the next attempt's reservation takes the #478 capture path, or abandons the block with capture off. The check reads only memory, so the renewal stays the last database step before the send. Leased candidates, reserved without a revision check, are unchanged. The ops doc's offer_reserved row names the new release, and a unit test pins carry_paying_unsendable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…re census 454ccca moved release_unsent_offer's transaction into release_unsent, which release_unmade_offer shares, so the census saw an unclassified site and a stale one. It is the same ledger checkout, renamed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…before extranonce1 Codex P1 on 835963e. PRISM_STRATUM_EXTRANONCE2_SIZE is not in the pair's fingerprint. finder_node read extranonce1 at this node's width, so on a peer block issued with another width it read four other bytes, which could fall in this node's half: both nodes then took the block for their own, and both funded conflicting CPFP children of its zero-fee fanout, leaving the losing wallet's coin reserved. finder_node now reads extranonce1 at this node's width only where the coinbase tag sits right before it, as every coinbase this pool builds has it. A block issued with another width therefore names no node, and found_here falls back to its origin: a peer-landed block is never taken for this node's own. This is a check of one placement, not a search over widths, which a short tag or crafted extranonce bytes could fool. An empty tag checks nothing, as before. The ledger records the tag with the width (set_coinbase_layout), and unit tests cover a peer block issued with widths 4 and 12 against a local 8, another tag, and an empty one. The ops doc says to keep the width and a non-empty tag the same on both nodes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This closes the extranonce2-width class. Only two paths read a peer's coinbase with this node's PRISM_STRATUM_EXTRANONCE2_SIZE: - adoption's suffix check, which reads the issuing width from the record since 476fdd9; - finder attribution, which since 18c18b5 reads extranonce1 only where the tag sits right before it. A block issued with another width names no finder, and its origin decides. Every other width use builds or serves this node's own work. The gated refusal test's control now adopts the block on a second frontend whose width is half the one the work was issued with. The adoption loop waits for the own-log latch, then adopts the block from its own record, and the rebuilt coinbase is byte for byte the block's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on fa9ca53. finder_node names no node for a block issued with another extranonce2 width, and found_here then fell back to the block's origin. An adopted block carries the adopter as its origin, so the adopter took a cross-width adopted block for its own find. It sponsored the zero-fee fanout at once, bypassing the takeover's overdue and silence checks, while a recovered finder, whose own layout names it, sponsored it too: conflicting CPFP children, and a wallet coin left reserved. Every coinbase a dual-writer node builds names it: the tag sits right before its own extranonce1. A coinbase that names no node was therefore issued elsewhere, and found_here no longer falls back to the origin for it. Such a block is sponsored here only by takeover, adopted or not. Without a recorded layout or a coinbase, the origin still decides. A node that changes its own tag or width while its blocks still await fanouts stops taking them for its own finds, which the ops doc already rules out. The gated refusal test now checks that, after the narrow-width frontend adopts the block, only the issuing layout names its finder. Unit tests cover an adopted cross-width block and an unparseable coinbase with this node's origin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… bytes Codex P1 on a7acc04. finder_node reads extranonce1 only where the coinbase tag sits right before it, but PRISM_COINBASE_TAG may be empty, and an empty tag verifies nothing. With unequal extranonce2 widths, both nodes could then take a block for their own find and fund conflicting CPFP children. A tag of a byte or two could also match by chance. A dual writer now refuses to start unless PRISM_COINBASE_TAG has at least 4 bytes (the default /PRISM/ has 7). Single writers keep their choice, an empty tag included. A unit test covers the check, the README and the ops doc say so, and D1's dual_writer and config_cli suites still pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…until it stays so for the takeover delay Codex P1 on 1aba741. When the finder's database answered with no work of its node at all, finder_silent took that as silence on the first read. That happens just after the frontend starts, or once its expired work is pruned. A live finder could still sponsor its overdue fanout as its own while this node took it over: conflicting CPFP children. Such an answer is now unknown: the liveness state notes since when the checks have found no work, any check that finds work clears that, and the finder counts as silent only once there has been none for SPONSOR_TAKEOVER_AFTER. The gated takeover test runs a finder whose database holds no work: it is not taken over at once, and it is taken over once the checks have found none for the delay (assume_no_work_since). The ops doc says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t change Codex P1 on 7c8c72b. finder_node reads extranonce1 at this node's current PRISM_STRATUM_EXTRANONCE2_SIZE and coinbase tag. A block this node found before either changed therefore named no node, and found_here took it for the peer's. The peer read no finder either, so neither node sponsored the zero-fee fanout as its finder. A coinbase that names no node now counts as this node's find when the block carries this node's origin and this node holds the block's outbox row. The outbox is local and never copied, and an adopted block has none, so a cross-width adoption is still sponsored here only by takeover (a7acc04). Without a recorded layout or the coinbase, the origin still decides. The fanout sponsor, reconcile and divergence reads each select the outbox flag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…time Codex P2 on 6264cd4. compact_prepared_on_parent fetched every prepared record on a block's parent, each joined to its template and balances, in one fetch_all. A parent that stays current for hours, as in a chain stall on a busy mempool, holds many such records from both writers, so a single adoption could hold all of them in memory at once on the survivor. compact_prepared_on_parent now returns only the keys, newest first, and compact_prepared_held loads and decodes one record at a time, expired or not. A record that is gone, does not decode or has lost its blobs is reported among the block's refusal reasons. The pool-acquire census classifies the new checkout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on 4d8897c. With no prepared record of the finder's held here (none synced yet, or its copies expired after the 24-hour retention), the fence found every matured fanout overdue at once. The broadcaster then took it over after its finder's database failed three checks over one minute, an outage that only means silence when the stale copy here already shows the takeover delay. A live finder behind an asymmetric database outage could have its fanout funded twice. The fence now reports such a fanout as Unwitnessed rather than Overdue, and the broadcaster takes it over on an outage only once the outage itself has lasted SPONSOR_TAKEOVER_AFTER. A database that answers is read as before. The cached verdict is re-evaluated against each caller's outage threshold, so one fanout's verdict never shortens another's wait. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on a7ce81e. PeerJournal::work_age combined the peer's URLs by the youngest age and let any age override a path that answered with no work. When the current path holds none (a frontend just restarted) and a lagging fallback still holds an old row, the stale age won, and the broadcaster could take over a live finder's fanout once that row was 30 minutes old. youngest_work_age now lets work younger than the takeover delay on any path win, since it shows the finder alive. Otherwise a path with no work makes the age unknown, which waits on the broadcaster's 30-minute no-work timer. Only when every path shows stale work does the youngest decide. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on 9c0b64f. Under two PRISM_STRATUM_EXTRANONCE2_SIZE widths, a miner can place the coinbase tag and a value from the other node's range inside its own extranonce2 at the narrower width's offset. Both nodes then read themselves as the block's finder and fund conflicting CPFP children. The tag-adjacency check only made accidental collisions rare, and the pair's fingerprint binds neither the width nor the tag. Each node now reads the peer's tag and width from the coinbase suffix of the peer's newest prepared record it has synced, so no schema or grant changes. While they differ from this node's: - the carry owner guard builds carry-free work on either node under a new alerting reason, layout_mismatch; - fanout_sponsor sponsors nothing as finder or by takeover, and only finishes a CPFP package it already holds; - adoption refuses each block, which the pass reports with its ALERT. carry-owner status prints the mismatch. The metric label, scrape contract, generated metrics doc, census and ops docs follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on 57972c7. The guard's live read takes the first peer URL that answers. An owner restored from a backup older than its release, started while the peer's primary was out of reach, could read a lagging fallback that still showed the peer as non-owner and this node's old claim. A fresh guard then confirmed the peer and opened the carry gate while the peer, which had acquired, was paying too. PeerRead::Answered now says whether PRISM_PEER_DATABASE_URL answered. Only that answer confirms the peer or lets this node seed its journal, as carry-owner transfer already reads only the primary. A fallback answer still stops payments: a claim, a newer row of this node's, or an unseeded peer it shows counts. Once confirmed, an owner keeps paying through a fallback answer, as through an unreachable peer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… held Codex P1 on 02474ed. layout_mismatch reads the peer's coinbase layout from its newest prepared record synced here, and took the layout to match when none was held. While the jobs stream was refused or lagging, a pair with two layouts could therefore pay carry, and sponsor fanouts as their finder. With none of the peer's records held, the carry owner guard now reads the peer's newest coinbase suffix live over PRISM_PEER_DATABASE_URL only (PeerJournal::primary_suffix), and the ledger keeps it for the fanout and adoption checks. The layout is unknown, and taken to match, only while the primary shows no work or has never answered, so a peer whose records expired and whose database is gone does not hold the survivor carry-free. Held records decide and clear the live value. carry-owner status reads it the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on d42ea51. With PRISM_PEER_DATABASE_URL out of reach, a lagging fallback that answered with work 30 minutes old or more gave work_age that stale age, and finder_silent took the finder for silent at once. That skipped the outage timing, including the 30 minutes an Unwitnessed fanout needs. A live finder whose primary this node cannot reach could have its fanout funded twice. PeerJournal::work_age now knows whether the primary answered. Without it, only work younger than the takeover delay counts, as the finder alive; a fallback's stale or empty answer is no answer, so the broadcaster times it as an outage against the fanout's threshold. With the primary answering, the rules are as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on 1b87916. carry-owner transfer's scan_start let --from-height equal the tip the peer's last acquire recorded. If the chain reorganized after that acquire to a fork below its tip, the peer, already owner, could find carry-paying blocks at heights under it. The scan would miss them, the transfer would pass without their landing rows, and this node could pay the same carry again. The scan must now start SCAN_REORG_MARGIN below the recorded tip: the coinbase maturity, the depth PRISM already treats as final, where a mature pool block disconnected is a fatal state. The default --from-height 0 is unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on 11765f5. The offer rechecked only this frontend's in-memory carry gate before submit_block. A carry-owner release, committed by the operator's own process, reaches the gate only at the guard's next check, so a carry-paying block reserved before the release could still be sent after it. The new owner's transfer scan might already have read that tip, and the block's carry could be paid twice. Right before the send, alongside the gate, a carry-paying block reserved as current work now also reads this node's latest journal row. If the row no longer claims ownership, nothing is sent, and the reservation returns to pending as for a moved gate. Carry-free work is unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…; refuse equal-epoch claims Two Codex P1s on b4dbb57. The offer's journal read before submit_block returned its error with ?, after the reservation had committed. The failed attempt then kept the block offer_reserved, which recovery treats as a call that may have run, so a valid block would never be offered again. A read that fails is now taken as withdrawn: nothing is sent, and the reservation returns to pending as for a moved gate. carry-owner transfer took the newer of the peer's live and synced claims by epoch, and silently chose one when they differed at the same epoch, a sign that the peer's journal was rewritten. A different recorded tip could then let a later --from-height pass scan_start. Such a conflict now fails scan_start. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex P1 on e776ee9. The guard's check returned with ? when the peer layout read failed, after the live peer read and before Guard::decide. The run loop keeps the gate as it is on an error, so a claim the peer read had just shown went undecided, and an open gate stayed open while the peer might also be paying. A layout read that fails now counts as a layout mismatch, so the check decides carry-free and alerts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4b1e8e5 to
21cf3ae
Compare
Rebased onto 3.x.x after #767 was squash-merged (44fd3e4), as one commit: the branch merged D3 heads, so a commit-by-commit replay conflicts. The tree is identical to the reviewed head 571fc6b. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebased onto 3.x.x after #767 was squash-merged (44fd3e4), as one commit: the branch merged D3 heads, so a commit-by-commit replay conflicts. The tree is identical to the reviewed head 571fc6b. Co-authored-by: Claude Opus 5.5 <[email protected]>
The notes cover everything since v3.0.0-rc.6: #770's import-audits fix (#765) and #760's idle-connection bound (#759), which would have shipped as rc.7, and the 3.1 dual writer (#766, #768, #767, #769, #763), off by default. They describe the new settings, migrations 027, 028 and 031 (029 and 030 reserved), the upgrade from rc.6 with the migrate run while rc.6 serves, the rollbacks, and the dual writer's known limits. The migration guide's import-audits paragraph names this candidate in place of the skipped rc.7. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* 3.x.x: version 3.1.0-rc.1 VERSION, the workspace version and both lockfiles move to 3.1.0-rc.1. The fuzz lockfile also picks up hyper and hyper-util, which #769 added to the server without refreshing it. The 3.0.0 and development-line notes point at the new candidate; its own notes follow in this pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: 3.1.0-rc.1 release notes The notes cover everything since v3.0.0-rc.6: #770's import-audits fix (#765) and #760's idle-connection bound (#759), which would have shipped as rc.7, and the 3.1 dual writer (#766, #768, #767, #769, #763), off by default. They describe the new settings, migrations 027, 028 and 031 (029 and 030 reserved), the upgrade from rc.6 with the migrate run while rc.6 serves, the rollbacks, and the dual writer's known limits. The migration guide's import-audits paragraph names this candidate in place of the skipped rc.7. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: 3.1.0-rc.1 notes: #773's pre-migrate tests Co-Authored-By: Claude Opus 5.5 <[email protected]> * 3.x.x: 3.1.0-rc.1 notes: the rollback to one writer stops and syncs the peer first Codex on #774: DOWNGRADE fences nothing, so the peer must be stopped, and its tail pulled, before the single-writer start; declare the tail lost only for a peer that never returns with its own database. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Do not merge: part of the 3.1 stack, teed up for review.
Stack position 3/5:
3.x.x← D1 (identity and peer sync) ← D2 (window cuts) ← D3 (this PR) ← D4 (readiness) ← D6 (E2E). The design is inCONTRACT.mdof the 3.1 run: two independent writers, one carry owner. Background is in PR #761.With
PRISM_DUAL_WRITERoff, nothing here changes behaviour:No migration.
What changes
Carry-free work on the non-owner (
ledger/carry.rs)payout_state.SETTLEMENT_LOCK, which the bump also takes, so work built under the old mode is always superseded. And while the gate is closed, or a change of it awaits its bump, the offer reservation never takes a block on carry-paying work for current work, whatever its revision: it goes through the 3.x.x: An own block found 9 s after the previous landing was refusedunknown-joband never reached the node #478 capture bound. If the gate moves between the reservation and the send, the block is not sent and its reservation returns topending, due again at once.carry-owner releasetakes effect at its commit, not at the guard's next check.unknown-joband never reached the node #478 records measure against the canonical balances. A landing that rebuilds a window from current balances (its as-issued snapshot is gone) reads the balances of the window's own mode, never today's gate. In dual mode a carry-free block is never a divergent landing.The owner guard (
carry_owner.rs)PRISM_CARRY_OWNER;qbit_prism_node_roles;releaserow.release, only a claim thatcarry-owner transfermade after reading it pays: theacquirerecords the peer epoch it read. Otherwise the state isclaim_not_vetted.peer_journal_behind: a rolled-back peer);no_journal_rowandpeer_not_seeded, which every fresh start passes through, are quiet only during start-up: 2 minutes after the own-log latch is first set, or the first 10 minutes without one.qbit_prism_carry_owner_state{state},qbit_prism_carry_owner_alert,qbit_prism_carry_owner_peer_checks_total{result}.Peer settlement (
ledger/blocks.rs,ledger/divergence.rs)prepared(D-1, D-10). The existing reconciler confirms, deactivates and matures them as local state, sets the halt on a mature disconnect, and bumps the revision once per change. So the owner's balances include a peer's landings once its own chain view confirms them.PRISM_STRATUM_EXTRANONCE2_SIZEand only where the coinbase tag sits right before it. A block issued with another width or tag names no finder here. It counts as this node's own only when it carries this node's origin and this node holds its outbox row, which is local and never copied. That covers this node's own block found before its width or tag changed. An adopted block has no outbox row, so a cross-width adoption is sponsored here only by takeover. Adoption reads a peer record's own width, so it lands either way (tested end to end). A dual writer refuses to start without a coinbase tag of at least 4 bytes. A block found on the peer's work writes no divergence record here, is not counted as found, and credits no deferred share, whichever node landed it. The pair must issue work with onePRISM_COINBASE_TAGand onePRISM_STRATUM_EXTRANONCE2_SIZE: each node reads the peer's from the coinbase suffix of the peer's newest synced prepared record, and while they differ the guard builds carry-free work on both nodes under the alerting statelayout_mismatch, no zero-fee fanout is sponsored as its finder or taken over (a held CPFP package is finished), and no block is adopted.carry-owner statusprints the mismatch.Peer fanouts (
broadcaster.rs,ledger/fanout.rs)Ledger::fanout_sponsor, which also fences the funding reservation): the block matured here, and the finder's newest work held here (a synced prepared record) was published, at least 30 minutes ago.broadcaster::sponsors_fanoutruns the fence, then the liveness check. One check runs at a time, and its verdict serves every fanout for 30 s.Held).Blocks found by a dying node, S8 (
coordinator/adoption.rs)Ledger::land_adopted_block.qbit-prism-server carry-owner status|release|transfer(carry_owner/transfer.rs,tools.rs)releasejournals the release with the tip height, read underSETTLEMENT_LOCK, and bumps the revision, in one transaction.transferrefuses unless:PRISM_PEER_DATABASE_URL(never the fallback, which may reach a copy lagging its journal) and does not claim ownership, neither in the newer of its live and synced rows nor in its live journal;--from-heightis no higher than the tip the peer's last claim recorded (anacquire's), or 0 for a peer that owned since its seed, and the peer's claims were read live;apply_node_roles), then journalsacquirewith the peer epoch it checked.docs/prism-ledger-ops.md, section "Dual writer: carry owner and peer settlement (3.1)".Notes for reviewers
Follow-ups
layout_mismatch), which closes the crafted-extranonce2 double-sponsor Codex raised (thread 4290444234). The reconcile count of peer first confirmations and the divergence record still read attribution for blocks issued before a mismatch was noticed; new work is carry-free meanwhile, so they create no debt.submitblock, a carry-paying offer rechecks the gate and reads this node's journal, but does not hold the release out across the RPC (Codex thread 4291126776). A late block needs this process to stall for the release depth between that read and the call, plus a reorganization at least that deep. A database fence would close it:carry-owner releaserefusing while a carry-paying candidate of this node isoffer_reserved.carry_paying_not_current). The dual-writer fixture needs an opened-then-closed gate with carried balances, which this PR does not have yet.pendingbecause the gate moved has already run its standby and peer-ingest waits, and the retry counts them again.How it was tested
tests/carry_owner_invariants.rs(pure, 12 tests). A model of invariants 1 and 2 against the realapply_payout_policy, over random owner, non-owner and foreign blocks, sync lag, reorgs and maturity.unknown-joband never reached the node #478 race overpays only with an own block missing, and within F; an unreconciled reorg overpays.tests/carry_owner_postgres.rs(gated, 9 tests). Covers:releasetaking effect at its commit while the gate is still open;tests/carry_owner_guard_postgres.rs(gated, 12 tests, two databases). Covers:transferreading the peer only overPRISM_PEER_DATABASE_URL, refusing while that path is down even with the fallback answering;release, andtransferrefusals and success, including the journal tail copy and a scanned tip reorganised away before the acquire;tests/carry_owner_adoption.rs(gated, end to end with the fake node):ee06c17b; the later commits change no single-writer path. All passed:ledger_postgres(250),b478_payout_integrity,b478_capture_overpay,ctv_fanout_bookkeeping;window_balance_order,fanout_revision_bump,compact_prepared_storage, observability,b478_stale_revision_block.ledger_postgresandb478_capture_overpay, and a group of lib tests, failed. They pass when rerun alone.a_dual_writer_snapshot_refuses_without_the_origin_indexcounts advisory locks cluster-wide, so it fails whenever another database on the server holds one. Reported to D2.money_path_vectorsis unchanged.🤖 Generated with Claude Code