Skip to content

Fix UTXO dual-write rollback + normalize mempool storage (rebased #7679) - #7928

Merged
Scottcjn merged 3 commits into
mainfrom
rebase/7679-utxo
Jul 10, 2026
Merged

Scottcjn merged 3 commits into
mainfrom
rebase/7679-utxo

Conversation

@Scottcjn

Copy link
Copy Markdown
Owner

Rebase of #7679 by @qiann0512-gif onto current main (it had drifted into conflict). Security-positive UTXO hardening:

  • Rolls back the UTXO spend when the dual-write shadow balance is insufficient (new 409 DUAL_WRITE_SHADOW_BALANCE), closing a UTXO/account divergence hole.
  • mempool_add now stores only whitelisted fields — strips caller-supplied _allow_minting, oversized spending_proof, and junk before persisting.
  • Adds # fetchall-ok annotations on two already-paginated queries.

Both conflicts (two test files) were additive — kept both test sets. 141 tests + 39 subtests pass.

Closes #7679.
Co-authored-by: qiann0512-gif
Signed-off-by: Scott scottbphone12@gmail.com

codex added 3 commits July 9, 2026 21:06
Signed-off-by: Scott <scottbphone12@gmail.com>
Signed-off-by: Scott <scottbphone12@gmail.com>
Signed-off-by: Scott <scottbphone12@gmail.com>
@Scottcjn
Scottcjn merged commit 2180ac3 into main Jul 10, 2026
9 of 10 checks passed
@Scottcjn
Scottcjn deleted the rebase/7679-utxo branch July 10, 2026 02:06
@github-actions

Copy link
Copy Markdown
Contributor

RTC Reward

This merged PR earned 5 RTC — sent to Scottcjn.

RustChain Bounty Program

@github-actions github-actions Bot added size/L PR: 201-500 lines BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ BCOS v2 Scan Results

Metric Value
Trust Score 48/100
Certificate ID BCOS-697559e5
Tier L1 (not met)

BCOS Badge

What does this mean?

The BCOS (Beacon Certified Open Source) engine scans for:

  • SPDX license header compliance
  • Known CVE vulnerabilities (OSV database)
  • Static analysis findings (Semgrep)
  • SBOM completeness
  • Dependency freshness
  • Test infrastructure evidence
  • Review attestation tier

Full report | What is BCOS?


BCOS v2 Engine - Free & Open Source (MIT) - Elyan Labs

@qiann0512-gif

Copy link
Copy Markdown
Contributor

Thanks for rebasing and merging my contributions in #7927 and #7928.

Could you check the reward attribution for these two rebased PRs together?

This looks like the automatic reward may have followed the author of the replacement PR rather than the original contributor. The comments alone do not establish the actual ledger settlement, so please verify whether these rewards were separately credited or corrected before making any additional payment.

My original PRs used payout ID github-qiann0512-gif; other reward comments for my contributions use qiann0512-gif. Both names refer to this one contributor. If these two rewards remain uncredited to me, please confirm the correction process and appropriate payout identity. This request concerns the two reported 5 RTC PR rewards only, separate from the one-time welcome-bonus eligibility request in #29.

Scottcjn added a commit that referenced this pull request Nov 18, 2026
…8486)

Two tests still encoded the pre-#7928 behaviour: "the UTXO transfer
succeeds (200) and the account write is skipped" when the sender's
account balance cannot cover it. #7928 deliberately made that path fail
closed (409 DUAL_WRITE_SHADOW_BALANCE) and roll the UTXO application
back, because letting the spend through while skipping the account write
is exactly the success-path divergence dual-write exists to prevent -
/utxo/integrity would report the models disagreeing while the endpoint
returned ok=True. The tests have been red ever since.

Assert the real contract: 409 with the code and shadow_balance_i64, both
balances unchanged, and (new) the sender's UTXO value still unspent, which
is what proves the rollback. Renamed skipped_* -> refused_* so the names
match the behaviour; no other references to those names exist.

This matters more now that dual-write is enabled in production.
node/tests/test_dual_write_shadow_balance.py: 9 passed (was 7 passed,
2 failed). CI tests/: 4024 passed, 0 failed. The 13 remaining failures in
node/test_utxo_*_poc.py are pre-existing and unchanged by this commit
(stale PoCs that assert already-fixed bugs are still present).

Signed-off-by: Scott <scottbphone12@gmail.com>
Co-authored-by: Scott <scottbphone12@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/L PR: 201-500 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants