Skip to content

mempool: align output policy with Handshake - #67

Merged
wolf31o2 merged 1 commit into
mainfrom
fix/handshake-standardness
Jul 15, 2026
Merged

wolf31o2 merged 1 commit into
mainfrom
fix/handshake-standardness

Conversation

@wolf31o2

@wolf31o2 wolf31o2 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

  • align native Handshake output standardness with hsd v8
  • classify null-data, unknown, and unspendable addresses and covenants centrally
  • use exact hsd dust sizing, exemptions, fee rounding, and null-data ordering
  • apply the shared classifications to checkpoint validation, UTXO handling, and GCS construction
  • restore and extend policy tests for reserved addresses, unknown covenants, dust boundaries, fee scaling, and overflow

Reference parity

Compared against pinned hsd commit 9f013c1cb7f92edf94db69fbd69daf34adf655fb:

Validation

  • make build
  • make unit-cover
  • make unit-race
  • make integration
  • make hsd-interop
  • make lint workers=2
  • go vet ./... in the root, hnsutil, and hnsutil/psbt modules
  • focused mempool, wire, blockchain, and GCS builder tests repeated 10 times
  • git diff --check origin/main...HEAD

Summary by cubic

Aligns mempool output standardness and dust policy with Handshake hsd v8 for parity. Centralizes address and covenant classification across mempool, blockchain, and gcs to ensure consistent behavior.

  • Refactors
    • Standardness: treat unknown native address versions as nonstandard; reject unknown covenants unless the output is native nulldata (version 31); keep single-nulldata limit.
    • Dust: match hsd sizing and fee rounding; exempt native nulldata and state-carrying name covenants; add overflow-safe fee calculation.
    • Centralization: add wire.Address helpers (IsNulldata, IsUnknown, IsUnspendable) and wire.Covenant helpers (IsDustworthy, IsUnspendable); use them in checkpoint validation, UTXO unspendable checks, and basic filter (gcs) construction.
    • Tests: restore and extend policy tests for reserved address versions, unknown covenants, dust boundaries with custom fees, fee scaling, and overflow; add checkpoint and covenant/address classification tests.

Written for commit 2b587cd. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added clearer classification for addresses and covenants, including unknown, nulldata, dustworthy, and unspendable outputs.
    • Improved transaction policy handling for standardness, dust thresholds, relay fees, and covenant validation.
  • Bug Fixes
    • Improved checkpoint and transaction checks for unusual addresses and covenant types.
    • Corrected handling of unspendable outputs in transaction filtering and UTXO processing.
    • Added safeguards for zero values and fee calculations that could overflow.
  • Tests
    • Expanded coverage for address, covenant, dust, fee, and transaction-standardness edge cases.

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00ab4344-8c13-46c0-b112-a0cbc2a096b0

📥 Commits

Reviewing files that changed from the base of the PR and between 942fc45 and 2b587cd.

📒 Files selected for processing (9)
  • blockchain/checkpoints.go
  • blockchain/checkpoints_test.go
  • blockchain/utxoviewpoint.go
  • hnsutil/gcs/builder/builder.go
  • mempool/policy.go
  • mempool/policy_test.go
  • wire/address.go
  • wire/covenant.go
  • wire/covenant_test.go

📝 Walkthrough

Walkthrough

Adds native address and covenant classification helpers, then applies them across mempool policy, checkpoint candidate detection, UTXO output handling, and GCS filter construction. Relay-fee overflow and dust calculations are revised, while standardness checks now validate address and covenant classes with nulldata exceptions. Tests cover classification behavior, fee boundaries, dust outcomes, unknown covenants, and nulldata outputs.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change of aligning output policy behavior with Handshake.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/handshake-standardness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 9 files

You're on the cubic free plan with 11 free PR reviews remaining this month. Upgrade for unlimited reviews.

Re-trigger cubic

@wolf31o2
wolf31o2 merged commit 8314c38 into main Jul 15, 2026
13 checks passed
@wolf31o2
wolf31o2 deleted the fix/handshake-standardness branch July 15, 2026 20:31
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