multi: claim an exited asset VTXO into the tapd wallet - #1129
Conversation
The unroll puts the composed leaf on chain; once its CSV delay matures, the claim completes the leaf's sealed lineage into a confirmed proof file, spends the anchor through the exit leaf, and commits one transition into a fresh tapd-owned anchor. Script and internal keys both come from tapd, so the units become ordinary, spendable wallet balance when the claim confirms.
An asset leaf's worth is the assets riding on it, so the feasibility verdict priced in carrier sats refused every asset exit as uneconomical.
The wallet script plan derives a fresh asset script key at commit time, so a preview's commitment root never matches the commit and the anchor output script is only knowable afterwards. Ship a placeholder template and adopt the committed transaction's script instead.
Publishing verifies the transition against tapd's own proof archive, so the leaf's confirmed lineage is imported first. The OP_TRUE script key is declared from its own witness material: script and control block carry the internal key and tapscript root. Declaring at claim time is correct, since the anchor is on chain under the owner's exclusive control and the claim spends it in the same flow.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 865f091ce4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| committed, err := driver.CommitClaim( | ||
| ctx, buildRequest(anchorPSBT), nil, | ||
| ) |
There was a problem hiding this comment.
Persist the committed claim before continuing
If the request is canceled, waved crashes, signing fails, or publishing returns an ambiguous error after CommitClaim succeeds, the only copy of committed.packageBytes is lost even though tapd has already been mutated. A retry starts from scratch, derives new wallet keys, and commits another transition rather than resuming the exact package, which can leave a pending/leased transfer or create a conflicting double spend and strand the asset until manual reconciliation. As the onboarding workflow does, journal the commit attempt and exact transfer package/final PSBT by outpoint before signing and publishing, and serialize retries for that outpoint.
Useful? React with 👍 / 👎.
1aa2174
into
darioAnongba/taproot-assets-oor-runtime
Client half of the asset VTXO unilateral exit, stacked on #1128. Test counterpart: lumos#774 (see the PR list on the integration epic); design: https://taproot-assets-ark.lightning.wiki/.
An unroll already materializes the pre-signed tree on chain and withholds the final sweep for asset targets, so an exited asset leaf ends as a confirmed composed output under the owner's exclusive control. This PR adds the step that turns that output into ordinary tapd balance: the claim.
The claim (
tapassets.ClaimAssetVTXO, driven bywaved.Server.ClaimAssetVTXO) is stateless and runs in one flow:ConfirmProofFileassembles a full confirmed proof file from them.The wallet script plan derives a fresh asset script key at commit time, so there is no preview fixed-point to converge on: the claim commits against a placeholder anchor script, validates the committed transaction's shape and fields, and adopts the committed output script as the thing to sign.
One adjacent fix:
preflightUnrollFeasibilityprices an exit in carrier sats, which refused every asset leaf as uneconomical. Asset targets are exempt, since the value that justifies the exit is the asset, not its carrier.tap-sdk is bumped for the confirmed proof-file assembly (tap-sdk#176) and an x-only
DeclareScriptKeyfix.Verified by
TestRoundAssetExitin lumos: board, unroll, mature the exit delay, claim, and a plain tapd transfer out of the claimed balance.