Skip to content

itest: cover custom-anchor MuSig2 key-path and tapscript script-path spends#162

Merged
darioAnongba merged 2 commits into
mainfrom
customanchor-signing-itests
Jul 14, 2026
Merged

itest: cover custom-anchor MuSig2 key-path and tapscript script-path spends#162
darioAnongba merged 2 commits into
mainfrom
customanchor-signing-itests

Conversation

@darioAnongba

@darioAnongba darioAnongba commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Closes #161.

Adds integration coverage for the two custom-anchor signing surfaces that the existing custom-anchor itests deliberately assert are empty (require.Empty(signingRequests.MuSig2) / require.Empty(signingRequests.ScriptPath)). Both are Ark-agnostic — described purely in builder terms (tapscript leaf / MuSig2 anchor key, script-path / key-path spend, proof verification).

TestCustomAnchorBuilderScriptPathTimeoutSweep

Unilateral timeout exit:

  1. Locks a minted asset into an OP_TRUE output whose Bitcoin anchor commits a CSV relative-timelock tapscript leaf as a sibling to the asset commitment, under a NUMS internal key (so the timeout leaf is the only spending path).
  2. Matures the timelock, then unilaterally sweeps through the script path: the asset input is authorized by the regenerated OP_TRUE witness (zero signatures, no counterparty), and the anchor is spent by signing the timeout leaf with a single key. The control block is reconstructed from the committed TaprootAssetRoot/TaprootMerkleRoot, exactly as an integrating host composes it.
  3. Verifies the swept proof imports and the balance transfers — the asset chains correctly and is not burned.

Closes the "proof regenerated without cooperation" property.

TestCustomAnchorBuilderMuSig2KeyPathSweep

Cooperative exit:

  1. Locks a minted asset into an OP_TRUE output anchored to a MuSig2-aggregated internal key (AggregateKeys(participants, false).PreTweakedKey, matching how the SDK reconstructs the committed key).
  2. Cooperatively sweeps it with a single aggregate key-path signature produced by an in-process two-party MuSig2 ceremony (nonce aggregation, partial signing, BIP-341 taproot-tweaked combine), applied via ApplyKeyPathSignature.
  3. Verifies the swept proof imports and the balance transfers.

Notes

  • Both sweeps are caller-funded and broadcast directly by tapd (no external fee-bump child), which keeps them independent of shared miner-wallet state.
  • Ark VTXO-tree orchestration, connectors, forfeits, and arklib closures remain out of scope — they build on these primitives in the SwapDK repos.

Verified against the pinned tapd itest stack, including the full custom-anchor suite in one process (CI ordering): all four custom-anchor itests pass. go build ./..., go vet ./..., -tags itest build/vet, and gofmt all clean.

Lock an asset into an OP_TRUE output whose anchor commits a CSV timeout leaf, then unilaterally sweep it through the script path after the timelock matures. The sweep is caller-funded so tapd broadcasts it directly. Exercises the ScriptPath signing surface, caller-provided OP_TRUE asset witnesses, and non-cooperative proof regeneration without burning the asset.
@darioAnongba
darioAnongba force-pushed the customanchor-signing-itests branch from dabf4cc to 1ae6282 Compare July 13, 2026 22:44
@darioAnongba darioAnongba self-assigned this Jul 14, 2026
Lock an asset into an OP_TRUE output anchored to a MuSig2-aggregated internal key, then cooperatively sweep it with a single aggregate key-path signature produced by an in-process two-party ceremony (BIP-341 taproot tweak). Exercises the MuSig2 signing surface and non-cooperative asset-witness regeneration without burning the asset.
@darioAnongba darioAnongba changed the title itest: cover custom-anchor tapscript script-path (timeout) spend itest: cover custom-anchor MuSig2 key-path and tapscript script-path spends Jul 14, 2026
@darioAnongba
darioAnongba merged commit 932b4aa into main Jul 14, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from 🆕 New to ✅ Done in Taproot-Assets Project Board Jul 14, 2026
@darioAnongba
darioAnongba deleted the customanchor-signing-itests branch July 14, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

itest: cover custom-anchor MuSig2 key-path and tapscript script-path spends

1 participant