Skip to content

3.x.x: settle load runs through CTV fanout with --ctv-settlement, and count each landed block's direct, fanout and carried recipients (#548) - #644

Merged
kiwidream merged 1 commit into
3.x.xfrom
kiwidream/548-load-ctv-fanout
Oct 1, 2026
Merged

kiwidream merged 1 commit into
3.x.xfrom
kiwidream/548-load-ctv-fanout

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Closes #548.

Problem

The load harness launched every frontend with PRISM_CTV_SETTLEMENT_ENABLED=0. So every load run paid miners directly in the coinbase and never built a CTV fanout, while mainnet (tests/fixtures/mainnet-compose.env) runs with CTV on. #555's 10,000-recipient point (ten fanout chunks per block) needs the direct-to-fanout split under load.

Change

  • --ctv-settlement. Every frontend gets PRISM_CTV_SETTLEMENT_ENABLED=1 and the fanout fee policy mainnet pins: an explicit market rate of 1,000 bits per 1,000 weight and a 12,000 bps premium. The broadcaster stays off, and the settlement shape (PRISM_MAX_DIRECT_COINBASE_OUTPUTS and the rest) stays at the server's defaults. The keys go through the one launch composition (run::launch_environment), so the recorded environment is what ran.
    • The explicit rate means no frontend needs estimatesmartfee, which a regtest node cannot answer. The fake node's getmempoolinfo relay floor is the same rate.
    • With the flag off, the environment is byte-identical to before; the pr-smoke golden is unchanged.
  • Every checked-in preset pins "--ctv-settlement": false (all 28, including 3.x.x: Fault injection under load (L4/L5) (#487 S16) #554's two new fault presets). Turning it on for the mainnet-shape presets is a separate decision, per the issue.
  • Side report settlement block, flag on or off. It is read after the frontends stop, from the rows the server's landing writes in the block's own transaction: qbit_payout_carry_forward (miner accounts, onchain or accrued) and the outputs listed in qbit_ctv_fanout_artifacts' manifests.
    • Per landed block: settlement_mode, direct_recipients, fanout_recipients, carried_recipients, fanout_chunks, fanout_outputs. Totals across blocks, with blocks_by_chain_state. A block landed and later reorged still settled, so it is counted, and the breakdown shows how many there were.
    • A landed block without fanout is a measured 0. An accepted block with no landing, or with any fanout chunk whose manifest lists no readable output, goes to unmeasured_blocks and into no count. A failed read leaves the counts null, with the error redacted.
  • README, docs/prism-e2e-load-ci.md, test/e2e-scenarios.toml (r548-ctv-fanout-settlement-under-load) and test/prism-gated-tests.txt are updated.

Tests

  • New gated qbit-prism-load::ctv_settlement: a fake node with 100 sessions over 400 Zipf-weighted addresses, one scheduled block, --ctv-settlement, --pool-fee-bps 0. It checks that the run reconciles exactly (exit 0) and that the CTV keys are on and the broadcaster is off. Each landed block must be hybrid_coinbase_ctv_fanout, with 12 direct recipients (the server's default cap; with no pool fee, every slot is a miner's), one chunk, and fanout plus carried accounting for the rest. Passed in 43.9 s against PostgreSQL 16 with PRISM_TEST_REQUIRE_INTEGRATION=1.
  • New unit tests in tests/harness.rs:
    • ctv_settlement_sets_mainnets_ctv_keys_and_leaves_the_broadcaster_off: exactly three keys change, each to the value mainnet-compose pins, and each is read by config.rs.
    • the_fake_nodes_relay_floor_admits_the_pinned_ctv_fee_rate.
    • the_settlement_block_keeps_unmeasured_apart_from_zero: zero, unlanded, unreadable, partly unreadable (one of two chunks), reorged, failed and redacted cases.
  • cargo test -p qbit-prism-load --locked, one binary at a time, after rebasing onto the current 3.x.x: lib 43, harness 142, ctv_settlement 1, churn 6, faults 1, load_smoke 1, quorum_replication 1, realism 21, soak_plan 5 and soak_sampling 1 passed. Gated binaries ran against a private PostgreSQL 16 with PRISM_TEST_REQUIRE_INTEGRATION=1. real_node passed its fake-node golden but needs QBITD_BIN for its real-node test; see below.
  • cargo fmt --check and cargo clippy -p qbit-prism-load --all-targets --locked -- -D warnings: clean. scripts/check_e2e_scenarios.py: ok. python3 -m unittest tests.test_prism_load_matrix tests.test_prism_load_trend tests.test_prism_load_regress: 78 OK.
  • Two local fake-node runs (100 sessions, 400 recipients, 2 scheduled blocks):
    • flag on: hybrid_coinbase_ctv_fanout, with 12 direct, 388 fanout and 0 carried;
    • flag off: 400 direct and 0 fanout (measured).

Not run here and why

Merge notes

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

… count each landed block's direct, fanout and carried recipients (#548)

The harness launched every frontend with PRISM_CTV_SETTLEMENT_ENABLED=0,
so no load run ever built a CTV fanout and the direct-to-fanout split
mainnet runs was never exercised under load. #555's 10,000-recipient point
(ten fanout chunks per block) waits on it.

--ctv-settlement sets the three CTV keys mainnet-compose.env pins
(settlement on, an explicit 1,000 bits/1,000 weight market rate, the 1.2x
premium) through the one launch composition, leaves the broadcaster off
and the settlement shape at the server's defaults. Off, the environment is
byte-for-byte what it was (the pr-smoke golden is unchanged). The explicit
rate means no frontend needs estimatesmartfee, which a regtest node cannot
answer; the fake node's relay floor is the same rate. Every checked-in
preset pins the flag false, so each preset's sha256 changes once.

The side report gains a settlement block, flag on or off: for every block
the node accepted, the miner recipients the server's landing paid directly,
through fanout, and carried, read from qbit_payout_carry_forward and the
fanout artifacts' manifest outputs, which the landing writes in one
transaction. A landed block with no fanout is a measured 0; an accepted
block with no landing, or with fanout chunks whose outputs cannot be read,
is listed as unmeasured; a failed read leaves the counts null.

A block with any fanout chunk whose manifest lists no readable output is
unmeasured, not only one whose chunks list none between them, and the
totals break the measured blocks down by chain_state, since a block landed
and later reorged still settled. #554's two new fault presets pin the flag
false too.

A new gated test runs the fake node with 400 addresses, no pool fee and
the flag on, and checks 12 direct recipients (with a fee, the fee holds a
direct slot) and the rest in one chunk.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T16:46:27.400647Z 9d600a9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kiwidream
kiwidream merged commit 3f1fba6 into 3.x.x Oct 1, 2026
33 checks passed
kiwidream added a commit that referenced this pull request Oct 1, 2026
…offer, and stop issuing that work after an async promotion (#619)

Rebased onto 3.x.x 3f1fba6 (#642, #644) as one commit. It squashes the
series that was PR #645's head 60efddd:

- 263e4cd reproduce blocks on gap-issued work after an async promotion
  without qbitd, and weigh the options
- 37b1af7 require the mode 2 reproduction's new session to be issued
  readable work, not just any refusal
- 2fa8c80 refuse a block on work from a lost replication gap before its
  offer, and stop issuing that work after an async promotion
- 850547e document the refusal: the accepted D3 loss, the runbook for an
  already-offered block, and the decided design
- 7d229ac assert each test's outcome before its metric checks
- e7468f4 record the before/after runs in the design note
- c0a8018 tag work with the scan's timeline, name window_not_held in
  deferrals, count late refusals once, and pin the probe-error,
  out-of-order and clock cases
- 60efddd state the clock precondition and correct the runbook

Before a candidate is enqueued, the enqueue transaction checks that the
writer still holds the candidate's PPLNS window: the window's last share
row must exist and must be the window's own row. If it does not, the
block is refused as stale-job (window_not_held) and is never offered.
Prepared work is tagged with the writer timeline (#466's expression,
read in the scan transaction), so a promotion retires it, and issuance
authority refuses a window the promoted writer no longer holds. The
repair path and save_compact_prepared now require the endpoint to be
the window's own row, not just any row with that share_seq. Every
b619 reproduction now passes and is gated.

The only conflict was the cardinality pins: they become 77 families,
305 startup series and 956 populated series. These are 3.x.x's new
families and series plus this series' own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kiwidream added a commit that referenced this pull request Oct 1, 2026
…offer, and stop issuing that work after an async promotion (#619) (#645)

* 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)

Rebased onto 3.x.x 3f1fba6 (#642, #644) as one commit. It squashes the
series that was PR #645's head 60efddd:

- 263e4cd reproduce blocks on gap-issued work after an async promotion
  without qbitd, and weigh the options
- 37b1af7 require the mode 2 reproduction's new session to be issued
  readable work, not just any refusal
- 2fa8c80 refuse a block on work from a lost replication gap before its
  offer, and stop issuing that work after an async promotion
- 850547e document the refusal: the accepted D3 loss, the runbook for an
  already-offered block, and the decided design
- 7d229ac assert each test's outcome before its metric checks
- e7468f4 record the before/after runs in the design note
- c0a8018 tag work with the scan's timeline, name window_not_held in
  deferrals, count late refusals once, and pin the probe-error,
  out-of-order and clock cases
- 60efddd state the clock precondition and correct the runbook

Before a candidate is enqueued, the enqueue transaction checks that the
writer still holds the candidate's PPLNS window: the window's last share
row must exist and must be the window's own row. If it does not, the
block is refused as stale-job (window_not_held) and is never offered.
Prepared work is tagged with the writer timeline (#466's expression,
read in the scan transaction), so a promotion retires it, and issuance
authority refuses a window the promoted writer no longer holds. The
repair path and save_compact_prepared now require the endpoint to be
the window's own row, not just any row with that share_seq. Every
b619 reproduction now passes and is gated.

The only conflict was the cardinality pins: they become 77 families,
305 startup series and 956 populated series. These are 3.x.x's new
families and series plus this series' own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 3.x.x: classify #619's two pool checkouts, and pin the refusal at enqueue of a window that reaches past its anchor (#619)

CI on 384eb2a failed two checks for this PR's own reasons.

- The pool-acquire guard needs every checkout classified. Two new
  sites are classified "ledger" (delegated), like the existing
  Ledger::acquire sites: the landing's window probe in
  coordinator.rs::rebuild_claim_parts, and WorkLedger::window_held.
- audit_body_normalization's durable-range test built a window that
  ends with a share accepted after the anchor. It expected the landing's
  proof to refuse that window. The enqueue's #619 check now refuses it
  first, because the last row is not held at the anchor. The case now
  asserts that refusal: it is typed WindowNotHeld for the block and its
  last share_seq, nothing is pending, and no block or audit row is
  written. The other three cases still reach the landing's proof. Share
  history is immutable, so a candidate enqueued before this check
  existed cannot be built to reach the proof's final count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 3.x.x: list #619's two gated lib tests in the expected gate list (#619)

The gate proof on 5c261ad found two gated tests that ran but are not
in test/prism-gated-tests.txt. Both are lib tests from the #619 review
round:

- coordinator::miner_submit::acquire_tests::
  a_failed_window_probe_is_unknown_never_stale_and_enqueues_nothing
- ledger::window::payout_state::tests::
  a_snapshot_reads_its_writer_timeline_in_the_transaction_that_reads_its_rows

The list now holds 804 tests, the same number the proof saw run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
RobertClarke added a commit that referenced this pull request Oct 6, 2026
…count to the distinct sessions holding work, refuse a phase reported incomplete, and let a build older than #548 run with CTV settlement off (#511)

Addresses Codex's three open findings on 146f601, and the merge of
3.x.x.

A pinned count is now a count of distinct entries. The external tips
(`time_to_usable_work.tips`, by `tip`), the churn tips delivered
(`churn.tip_delivery.tips`, by `tip`) and the own blocks landed
(accepted `node.submissions`, by `block_hash`) each count an entry once,
by its name. A list padded with one tip repeated to the pinned length
fails, as does an entry that names nothing. Genuine reports list
distinct entries: each tip is a new block, and a node answers a block it
already holds as a duplicate, never accepted again.

The harness now reports the distinct count its start-up gate read,
`client.sessions_holding_work_at_start`. The comparator holds every run
that reports it to the pinned `--sessions`. `client.connects` counts
reconnects and rentals too, so 1,988 sessions and the D1 plan's 12
reconnects reached 2,000. It stands in only for a harness older than
the count, and tests/load_smoke.rs pins the count so a newer harness
cannot drop it unnoticed.

A planned phase must report `completed: true` (every harness since #271
does). A phase an abort cut in its last 5% was within the length
tolerance, and a run whose exit code missed the abort still counted.

#644 pinned `--ctv-settlement: false` in every preset, and 5d0042f's
harness has no such flag. legacy-flags.json now records that builds
before #548 (3f1fba6) launched every frontend with CTV settlement off,
so the release presets still resolve against 5d0042f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke added a commit that referenced this pull request Oct 6, 2026
… preset flags, and document L3 in the lanes page (#550)

#608 was stacked on an earlier #564. Since then #564's
`compare::Build` gained `predates_report_fields`. A collation
summarizes one build, the plan's commit, which predates no report field,
so the list is empty.

3.x.x added two result flags every checked-in preset must pin:
`--ctv-settlement` (#644) and `--faults` (#623). The three new presets
pin `false` and `null`, as the presets they derive from do, so each
differs from its source only in `--cadence` and `--scheduled-blocks`
(and the dense 1-frontend cell in its runner and schedule).

docs/prism-e2e-load-ci.md did not exist on #608's base. It now has
#626's L3 section: the lane table's row, the suites and triggers, what
L3 proves and does not, the dispatch commands and the evidence rows.
One correction to the draft: dispatch, like the weekly schedule, needs
the workflow file on `main`, so the status says L3 runs on pull
requests and tags until the file is mirrored there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke added a commit that referenced this pull request Oct 6, 2026
… them in the lanes page, and note that #548 has landed (#555)

3.x.x added two result flags every checked-in preset must pin:
`--ctv-settlement` (#644) and `--faults` (#623). The two session
points pin `false` and `null`, as `throughput-400k-window-2fe-async`
does, so they still differ from it only in `--sessions` and
`--stratum-max-pending-initial-jobs`.

#548 (CTV fanout settlement in the harness) landed as #644. The
10,000-recipient point still has no preset, but the README, the suite
comment and the scenario manifest now say it can be written with
`--ctv-settlement` on, rather than that it waits on #548. The
50,000-recipient trigger is evaluated once that preset runs.

docs/prism-e2e-load-ci.md gets #626's parts for this change: the
`l3-reduced` row's nine presets, its cost of about 200 runner-minutes a
week, and the capacity-envelope paragraph.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke added a commit that referenced this pull request Oct 6, 2026
… preset flags, and document L3 in the lanes page (#550)

#608 was stacked on an earlier #564. Since then #564's
`compare::Build` gained `predates_report_fields`. A collation
summarizes one build, the plan's commit, which predates no report field,
so the list is empty.

3.x.x added two result flags every checked-in preset must pin:
`--ctv-settlement` (#644) and `--faults` (#623). The three new presets
pin `false` and `null`, as the presets they derive from do, so each
differs from its source only in `--cadence` and `--scheduled-blocks`
(and the dense 1-frontend cell in its runner and schedule).

docs/prism-e2e-load-ci.md did not exist on #608's base. It now has
#626's L3 section: the lane table's row, the suites and triggers, what
L3 proves and does not, the dispatch commands and the evidence rows.
One correction to the draft: dispatch, like the weekly schedule, needs
the workflow file on `main`, so the status says L3 runs on pull
requests and tags until the file is mirrored there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke pushed a commit that referenced this pull request Oct 6, 2026
…didate, v* tags and weekly (#550) (#608)

Refs #550 (S5 of #487). prism-load-l3.yml runs #447's
production-window matrix as checked-in suites
(crates/qbit-prism-load/presets/suites.toml):
- l3-full: 11 cells x 3 repeats on the 32 vCPU class. It runs on a
  same-repository PR that changes VERSION, on the release-candidate
  label, on a v* tag and on dispatch.
- l3-reduced: 400k at 1, 2 and 4 frontends, weekly on 3.x.x.

#473's found-block and dense-cadence cells become presets.
qbit-prism-load-compare --collate renders one build's suite into #473's
tables with #511's summarizer. It writes a complete/passed verdict, and
lists any missing, foreign or edited run as failing the suite rather
than dropping it. A tag promotes the newest finished same-repository
PR run of l3-full whose verdict is complete for the tagged tree
(scripts/prism_l3_promote.py), and carries that verdict; otherwise it
runs the suite. check_e2e_scenarios.py gains a suites evidence key
beside 3.x.x's lane_checks.

Taken over per #626 and restacked onto 3.x.x after #564. The new
presets pin --ctv-settlement false and --faults null, as every preset
must since #644 and #623. collate fills #564's predates_report_fields.
docs/prism-e2e-load-ci.md gets #626's L3 section, which notes that
dispatch and the weekly run need the file on main. Spend: once this is
on 3.x.x, a v* tag or a VERSION-changing PR starts l3-full (about
$42); the coordinator accepted that for the release-candidate bump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke added a commit that referenced this pull request Oct 6, 2026
… them in the lanes page, and note that #548 has landed (#555)

3.x.x added two result flags every checked-in preset must pin:
`--ctv-settlement` (#644) and `--faults` (#623). The two session
points pin `false` and `null`, as `throughput-400k-window-2fe-async`
does, so they still differ from it only in `--sessions` and
`--stratum-max-pending-initial-jobs`.

#548 (CTV fanout settlement in the harness) landed as #644. The
10,000-recipient point still has no preset, but the README, the suite
comment and the scenario manifest now say it can be written with
`--ctv-settlement` on, rather than that it waits on #548. The
50,000-recipient trigger is evaluated once that preset runs.

docs/prism-e2e-load-ci.md gets #626's parts for this change: the
`l3-reduced` row's nine presets, its cost of about 200 runner-minutes a
week, and the capacity-envelope paragraph.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RobertClarke pushed a commit that referenced this pull request Oct 6, 2026
…reduced L3 (#555) (#614)

Refs #555 (S17 of #487), part a. The weekly l3-reduced suite now also
runs #555's session points and #521's mainnet shapes, nine jobs a week
on the 32 vCPU class:
- session-point-5000- and session-point-10000-sessions-400k-2fe-async:
  throughput-400k-window-2fe-async at 5,000 and 10,000 sessions, with
  admission at sessions per frontend + 16. A test holds them to differ
  in exactly those two flags. They are capacity-envelope points, not
  D1 verdicts: they gate reconciliation and steady_state shortfall.
  Refused and unanswered shares are reported, not gated.
- mainnet-shape-{130,650,2600}-addresses and
  rental-churn-bursts-and-storms.

The manifest marks session-points and mainnet-shapes-reduced-l3 as
running. The 50,000-recipient trigger is written down in the README:
the 10,000-recipient point costing more than 25% more per recipient
than the 1,000-recipient run. That point still has no preset;
since #548 (#644) it can be written with --ctv-settlement on.

Taken over per #626 and restacked onto 3.x.x after #608. Both presets
pin --ctv-settlement false and --faults null.
docs/prism-e2e-load-ci.md gets #626's l3-reduced row, cost and
capacity-envelope paragraph.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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