Repository navigation
tapassets: populate BIP-371 taproot metadata on plain OOR outputs - #1657
Merged
Merged
Conversation
Real tapd proof generation calls AddExclusionProofs on every non-asset P2TR output of an anchor transaction, requiring PSBT_OUT_TAP_INTERNAL_KEY and BIP-371 PSBT_OUT_TAP_TREE to prove that the output commits to no Taproot Asset tree. Plain Ark VTXO outputs on an OOR Ark transaction (sender carrier change and operator float change) are P2TR outputs with two-leaf Ark policy trees, so planOORArk previously caused tapd to fail with missing internal key on output 0. Populate TaprootInternalKey and depth-first BIP-371 TaprootTapTree on every plain P2TR output of the Ark anchor template passed to tap-sdk, and validate upfront that plain P2TR outputs carry a matching policy template before any checkpoint transition is committed.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When committing an OOR Ark asset transition against a real
tapdbackend, Taproot Assets proof generation callsAddExclusionProofson every non-asset P2TR output in the anchor transaction. Plain Ark VTXO outputs on an OOR Ark transaction (e.g., sender carrier return and operator float change) are P2TR outputs backed by two-leaf Ark policy trees, sotapdrequiresPSBT_OUT_TAP_INTERNAL_KEYand BIP-371PSBT_OUT_TAP_TREEon those PSBT outputs to prove that they carry no Taproot Asset commitment.planOORArkpreviously leftTaprootInternalKeyandTaprootTapTreeunset on non-asset outputs, causing realtapdcommits to fail with:cannot add exclusion proof, output 0 is a P2TR output but is missing the internal key in the PSBT.Changes
tapassets/oor_transfer.go:TaprootInternalKeyand BIP-371 depth-firstTaprootTapTreeon every plain P2TR output inplanOORArk's anchor PSBT template (while keeping the canonical returned Ark PSBT unchanged).OORTransferRequest.validate()that every plain P2TR output carries a matchingVTXOPolicyTemplatebefore committing any checkpoint transitions; non-P2TR outputs continue without requiring one.tapassets/oor_transfer_test.go:planOORArkpopulates valid BIP-371 internal key and tap tree metadata whose reconstructed Taproot output key matchesTxOut[i].PkScript.encodeBIP371TapTreeacross 1-, 2-, 3-, and 5-leafarkscript.BuildTreeshapes.tapassets/AGENTS.md/tapassets/CLAUDE.md: document the plain P2TR policy-template requirement for OOR transfers.Testing
go test ./tapassets/...(passes, including new unit tests).make fmt-changed && make lint-changed-local && make commitmsg-lint(0 issues).tapdinstance (2-hop OOR asset transfer with plain BTC carrier return and float change outputs).