mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 16:02:38 +00:00
policy: make unstructured Taproot annexes standard #36466
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36466
Loading…
Reference in a new issue
No description provided.
Delete branch "policy-unstructured-annex"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Make Taproot annexes standard for key and script paths:
0x50: marker-only opt-in.0x50 0x00 <data>: arbitrary data; other prefixes remain nonstandard.No annex-specific size limit; the existing 400,000 WU standard transaction limit applies.
This opt-in rule protects transactions that do not opt in. It does not prevent annex inflation by opted-in participants. Consensus and witness replacement are unchanged.
Builds on #27926 and Libre Relay.
Validation: full build, 17 transaction unit tests, full
feature_taproot.py, andgit diff --checkpassed.AI-assisted implementation and tests.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🟠 Minor · Signature-less Taproot annexes permit third-party inflation
For opted-in transactions spending a signature-less tapscript leaf, a relayer can race a larger, lower-feerate, same-txid variant into mempools, subject to admission limits.
Location:
src/policy/policy.cpp:338(head).🔵 Suggestion · Annex relay-policy change has no release note
This PR changes default annex relay policy but includes no release note for the accepted encodings and transaction-wide opt-in rule.
Location:
src/policy/policy.cpp:333(head).🔵 Suggestion · Anchor-stuffing test initializes the same witness twice
The pre-loop assignment to input 0's witness is overwritten before any assertion, so it adds redundant setup to the unit test.
Location:
src/test/transaction_tests.cpp:1364(head).🔵 Suggestion · Clarify why annex payloads remain unbounded
policy.cpp:338 checks only the prefix. One annex can use nearly the whole 400,000-WU budget (test at 1379-1384), which exposes opted-in participants to large inflation. The PR gives no stated payload requirement explaining why it drops #27926's 256-byte cap.
Location:
src/policy/policy.cpp:335(head).Review coverage was incomplete.
Reviewed:
b4179ad2fb61· Full review report · Previous reportspermalink
We should exclude spends of P2A outputs here, as they can't contain an annex.
@petertodd Thanks, fixed in
bb6ccd0. Native P2A inputs are exempt; their witnesses must remain empty.You should re-add the "witness stuffing detected" comment here to explain what this line is doing.
...and the comment about P2A inputs and the annex probably makes more sense here.
I'm confused by this fragment. It doesn't look like it's related to the annex stuff at all. Rather it's just skipping further checks if scriptWitness is empty.
It'd be more clear to say that "Annexes must be zero-length, or start with the unstructured data prefix, 0x00"
We should explain why the unstructured marker is being used here: 0x00 is reserved, so that future consensus-related usage of the annex can use a different prefix (quite possibly an entire encoding scheme).
You should use the term "transaction pinning attack" here, so people have something to google.
@petertodd Thanks, addressed in
b4179ad. The empty-witness check moved below P2A handling so anchors are counted before the earlycontinue.utACK
b4179ad2fbWhat is the purpose of this? I was imagining that annex standardness would be added at the same time consensus-relevant meaning would be given to annexes.
Of course, if there were active use of annexes on the network it would be useful to accommodate relay, but as of now I don't see the point.
@sipa The motivation is data availability for metaprotocols, including a range of shielded protocols such as Shielded CSV.
Annexes would let these protocols publish data directly in a Taproot key-path spend, avoiding the script-path commitment and reveal required by inscription-style encoding.
The motivation for enabling relay now is to support these applications. They need data availability independently of future consensus semantics for the annex; the proposed
0x00prefix distinguishes this unstructured use from future extensions.Standard relay would also let these applications reach miners through the public P2P network, reducing the incentive to build private mempools or depend on arrangements with individual mining pools.
ACK
I tested this on
b4179ad2fb, the unit and functional tests pass, and they fail with master'spolicy.cpp. I also changed the policy code in 7 ways (no P2A exemption, no opt-in rule, no prefix check, empty-witness skip before the P2A check, etc.) andannex_standardnesscatches all of them.A tx with one 399,580-byte annex (exactly 400,000 WU) is accepted, also by a node with
-datacarrier=0. #27926 had a 256-byte limit. Why remove it? Should node operators have an option to turn off annex relay?🐙 This pull request conflicts with the target branch and needs rebase.