Skip to content

3.x.x: #474 A: direct-settlement recipients, signed audit bundle checks, owning-wallet spends and a nightly 1,001-recipient chunk-boundary case - #607

Merged
Anatolie merged 2 commits into
3.x.xfrom
Anatolie/474-a-recipients
Sep 30, 2026
Merged

Anatolie merged 2 commits into
3.x.xfrom
Anatolie/474-a-recipients

Conversation

@Anatolie

@Anatolie Anatolie commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Refs #474 (slice A).

What

Extends the real-node weighted-recipients fixture (crates/qbit-prism-server/tests/support/live_weighted_recipients.rs, #524) to close slice A's gaps. Test-only: no production code changes.

  1. Direct settlement (CTV off), per PR. New real_weighted_recipients_pay_exact_direct_outputs_without_ctv: six addresses, each generated by its own wallet, with unequal weights (two whales, a Zipf tail, a payee paced just under the floor, a near-zero payee), through three blocks with the pool fee's dust sweep. The model has a direct-mode branch: every payable recipient is a coinbase output, and there are no chunks or fanout fees.

  2. Signed audit proof. For every found block, in all three cases, the test fetches /audit/blocks/{hash}/bundle (alternating servers). It verifies the bundle with verify_audit_bundle_against_coinbase_tx_hex against the node's coinbase, and pins the ledger key (seed 22) and the coinbase-manifest key (seed 11). It then compares the bundle with the independent model: window entitlements, every miner account (gross, prior, candidate, on-chain, settlement fee, carry, action), the pool-fee account and manifest (earned, swept, amount), direct coinbase credit by account, covenant outputs, and under CTV the settlement mode, direct recipients, the per-chunk fanout recipients and the committed fanout txids. The mined fanouts must equal the committed txids. compare_credit rejects missing, extra, double-credited and moved/renamed credit, and a unit test checks each of those failures.

  3. Owning wallets. Payee addresses are spread round robin over several wallets (6 in the direct case, 8 in the 40- and 130-payee cases, 16 in the 1,001 case). Each wallet must hold exactly what its own addresses were paid. For every block the test spends the smallest direct payee output and the smallest payee output of each fanout, using the wallet that owns it.

  4. 1,001 payable recipients across the 1,000-recipient chunk boundary, nightly. New #[ignore] recipient_boundary::nightly_1001_recipients_cross_the_fanout_chunk_boundary_to_spent_outputs (support/live_recipient_boundary.rs), registered in test/prism-nightly-gated-tests.txt. r474-a-1001-recipients in test/e2e-scenarios.toml moves from L4 to nightly with runs = true. How the accepted work arrived is reported by source:

    • Seeded: 999 shares for 999 recipients, through the production Ledger::append (writer seed-474), before the servers start. Weights are 1–4 units.
    • Submitted over Stratum: 12 shares from 4 recipients in 4 live sessions across both servers. One of these sessions found the block. 2 recipients have both seeded and submitted work.
    • The test does not exercise or claim 1,001 live mining sessions.

    The ledger's attribution is checked by source and writer. All 1,001 recipients are paid across fanout chunks [1000, 1], with the pool fee as a direct output. The audit bundle matches the model, and one output of each chunk is spent by its owning wallet.

Registrations: the direct test is in test/prism-gated-tests.txt, with a new running scenario r474-a-direct-recipients-share-to-spend.

Local evidence (SHA in the PR head; PG 16.15, qbit 1.0.0 via install-prism-qbit.sh, debug build, 22-core host shared with other workers)

QBITD_BIN=… PRISM_TEST_DATABASE_URL=… PRISM_TEST_PG_BIN_DIR=/usr/lib/postgresql/16/bin PRISM_TEST_REQUIRE_INTEGRATION=1 \
PRISM_TEST_GATE_MANIFEST=… cargo test -p qbit-prism-server --test live_regtest weighted_recipients_tests:: -- --nocapture --test-threads=1
  • direct: 6 payees on 11 workers submitted 300 accepted shares …; 3 blocks …; direct outputs [4, 6, 5], fanout recipients [0, 0, 0], 5 payees paid, sub-floor accounts [2, 1, 2] (1 later paid, 807155 bits swept …), 3 signed audit bundles matched the model, 3 payee outputs spent by 2 owning wallets: 30.5 s
  • per-PR CTV (40 payees): … 4 signed audit bundles matched the model, 8 payee outputs spent by 4 owning wallets: 59.8 s (49.7 s before this change on the same host)
  • credit_comparison_refuses_missing_extra_double_and_moved_credit: ok
  • gate manifest: both per-PR ids executed
… cargo test -p qbit-prism-server --test live_regtest -- --ignored --exact \
  weighted_recipients_tests::recipient_boundary::nightly_1001_recipients_cross_the_fanout_chunk_boundary_to_spent_outputs --nocapture
  • 1001 payable recipients in 16 wallets; accepted work: 999 seeded shares for 999 recipients through Ledger::append (writer seed-474), 12 shares (0 stale retries) submitted over Stratum by 4 recipients in 4 live sessions on both servers, 2 recipients with both; one block, window of 1010 shares, not cut; 1001 recipients paid 584139..2920694 bits, direct outputs 1, fanout chunks [1000, 1], 29683785 bit pool fee; the signed audit bundle matched the model; 2 payee outputs (one per chunk) spent by 2 owning wallets
  • Wall time: 381.2 s (6.4 min) including cleanup. Split: chain ramp and wallets 41.1 s, seeding 5.3 s, verification, maturity mining (1,000 blocks) and spend 328.1 s. The nightly live-nightly job has a 60 min timeout; its recent scheduled runs took 13–21 min.
  • gate manifest: executed …::recipient_boundary::nightly_1001_…

Also: python3 scripts/check_e2e_scenarios.py (ok), python3 -m unittest tests.test_check_e2e_scenarios tests.test_check_gate_manifest (34 ok), cargo clippy -p qbit-prism-server --test live_regtest -- -D warnings (clean), cargo fmt --check -p qbit-prism-server (clean).

CI (required integration shard 1, head cbc021f): direct 28.5 s; per-PR CTV 243.2 s, of which maturity mining took 167.8 s. On the first head the per-PR case took 346.8 s, and 3.x.x's recent runs of the unchanged test took 50–103 s. Locally, pinned to 4 CPUs, maturity mining took 2.2 s with 1 payee wallet and 2.3 s with 8, and the 8 wallets add about 5 s overall. So the CI maturity time looks like runner variance rather than this change. Each case now prints its wall clock by phase, so a slow run shows where the time went.

Not run locally: the full live_regtest binary and the other nightly variants. The 1,001 case has not yet run on the Blacksmith nightly runner; it will run in the next scheduled nightly.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 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-09-30T19:51:04.803860Z e049e4b New commits
ℹ️ 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.

…block's signed audit bundle, spend with the owning wallets, and run 1,001 recipients across the fanout chunk boundary nightly (#474)

#474 A. The weighted-recipients fixture now:
- runs a per-PR direct-settlement (CTV off) case: six addresses from six
  wallets, unequal weights, carry below the floor and the pool fee's dust
  sweep, through three blocks;
- verifies every found block's signed audit bundle against the chain's
  coinbase with the pinned test keys and compares its window weights,
  accounts, pool fee, coinbase outputs and CTV partition with the
  independent model, refusing missing, extra, doubled or moved credit;
- spreads payee addresses over several wallets and spends the smallest
  direct output and the smallest output of each fanout with the wallet
  that owns it;
- adds a nightly case with 1,001 payable recipients: 999 seeded through
  Ledger::append, 4 submitting over Stratum (2 both), paid across fanout
  chunks of 1,000 and 1, reporting seeded and submitted counts separately.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Anatolie
Anatolie force-pushed the Anatolie/474-a-recipients branch 2 times, most recently from c22c662 to 098d4d1 Compare September 30, 2026 19:47
…a slow run says where its time went (#474)

The per-PR CTV case took 346.8 s on its first CI run against 50-103 s on
3.x.x and 55 s locally; the summary could not say which phase grew. Each
case now prints the monotonic wall clock of every phase (ramp, wallets and
servers, rounds, model and audit, maturity, fanouts, receipts, spends)
before its scenario checks, so a failing run reports them too.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e049e4b39e

ℹ️ 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".

Comment thread test/prism-nightly-gated-tests.txt Resolved
@Anatolie
Anatolie merged commit aeddde1 into 3.x.x Sep 30, 2026
30 checks passed
djh58 added a commit that referenced this pull request Sep 30, 2026
Resolves live_weighted_recipients.rs against #607: its Policy, Payees and
the ctv and wallets fields stay, with #553's visibility, the opened-count
context and the connection-limit raise. The raise moves to
start_servers_for, so #607's 1,001-recipient case keeps start_servers as
it was, and #553's 2,000-wallet shape takes ctv and 8 wallets like the
other CTV shapes.
Anatolie added a commit that referenced this pull request Sep 30, 2026
… as the submit path records it, and check every share records it (#474)

#607 review (discussion_r4148698096): the seeded shares recorded the
candidate height from getblocktemplate, while the production submit path
and bootstrap share record template_parent_height(candidate), one lower,
as live_ctv_cpfp.rs does. They now record the parent height, and
check_sources requires every accepted share, seeded or submitted over
Stratum, to carry the found block's parent height.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Anatolie added a commit that referenced this pull request Sep 30, 2026
… as the submit path records it, and check every share records it (#474) (#624)

#607 review (discussion_r4148698096): the seeded shares recorded the
candidate height from getblocktemplate, while the production submit path
and bootstrap share record template_parent_height(candidate), one lower,
as live_ctv_cpfp.rs does. They now record the parent height, and
check_sources requires every accepted share, seeded or submitted over
Stratum, to carry the found block's parent height.

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