Skip to content

policy: detect BIP-110-era bare inscription envelopes (DO NOT MERGE until BIP-110 activates) - #1

Closed
BitcoinPR wants to merge 1 commit into
mainfrom
bip110-bare-envelope-filter
Closed

BitcoinPR wants to merge 1 commit into
mainfrom
bip110-bare-envelope-filter

Conversation

@BitcoinPR

Copy link
Copy Markdown
Owner

Context

Ordinals (ord#4545) has announced a BIP-110-compatible envelope shape: since BIP-110 disables OP_IF/OP_NOTIF in tapscript, the classic OP_FALSE OP_IF … OP_ENDIF inscription envelope dies — so they adapt to a bare envelope: <marker> <data> <data> … OP_2DROP … OP_DROP, a contiguous push run balanced by drops with no conditional. Our rejectparasites filter only recognizes the classic OP_IF shape, so the adapted shape would relay freely.

This PR mirrors Bitcoin Knots PR #319 (DatacarrierBytes counting of drop-balanced push/pushnum runs).

Changes

  • bare_envelope_scan (script.rs): counts contiguous runs of pushes and pushnums (OP_1NEGATE, OP_1..OP_16 — ord's parser accepts pushnums as payload, so an interleaved pushnum must not strand earlier pushes from the count) terminated by OP_DROP/OP_2DROP, spanning run start through the drop opcode. Byte accounting matches Knots' unit vectors exactly (the 25- and 26-byte cases).
  • tx_first_inscription_input now takes the datacarriersize threshold: classic OP_IF envelopes stay rejected at any size (unambiguous dead code); bare envelopes are rejected only when counted bytes exceed datacarriersize — so legitimate commit-and-drop tapscripts (a 32-byte commitment dropped before a key check = 34 counted bytes) stay standard under the default 83, and <locktime> OP_CLTV OP_DROP counts nothing (the non-push opcode breaks the run).
  • tx_token_protocol also scans bare-envelope payloads, so a BRC-20 mint in the new shape is still caught by rejecttokens.
  • Gated under the existing rejectparasites flag; policy only — block validation is untouched. docs/relay-policy.md updated with the bare-envelope section.

Verification

  • Gate fully green (fmt / clippy / audit / machete / test, --all-features)
  • New tests: run counting parity with Knots' vectors, pushnum interleave, commit-and-drop and CLTV negatives, no-drop negative, BRC-20-in-bare-envelope token detection, end-to-end mempool rejection + rejectparasites=0 opt-out

⚠️ Merge policy

Leave unmerged until BIP-110 activation is confirmed. The filter is harmless pre-activation, but this is deliberately parked to track the actual threat. Before merging: rebase onto main if needed and run the interop suite via the recreate-only-bitcoinpr procedure (see docs/relay-policy.md / TODO).

🤖 Generated with Claude Code

@BitcoinPR

Copy link
Copy Markdown
Owner Author

Closing: BIP-110 (RDTS) did not gain consensus and has been removed from the codebase entirely (see the 0.1.111 changelog entry on main). The "merge when BIP-110 activates" gate this PR was parked behind will never open, and the branch no longer applies cleanly to main.

The detection logic itself is independent of the softfork and still has standalone value as a rejectparasites pattern — it is preserved on the private development repo and can be reopened as a fresh, rebased PR if we decide to ship it on its own merits.

@BitcoinPR BitcoinPR closed this Aug 9, 2026
@BitcoinPR
BitcoinPR deleted the bip110-bare-envelope-filter branch August 9, 2026 16:07
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.

2 participants