Repository navigation
Conversation
c206f0d to
2814bf6
Compare
4283082 to
50595de
Compare
|
/gateway review |
|
👀 gateway review starting… |
starius
left a comment
There was a problem hiding this comment.
Style — ~18 unexported funcs and ~14 test helpers have no godoc, against the convention. Non-test: canonicalAddressParams, cloneAddressParams (both copies), validateScripts, genBtcControlBlock, validateAsset (both), findUniqueInput (both), validateSweep (both), validateSequence, verifyTapscriptSignature (both), timeoutPathSibling, encodedTimeoutPathSibling, newHtlcSwapKit, validateProof.
|
Follow-up commit 818876e also adds documentation to the unexported production and test helpers listed in the general review. Local verification passed: go test ./..., go test -race ./assets/..., go vet ./..., golangci-lint (0 issues), plus a Nautilus #1712 itest-package compile with integration tags. |
818876e to
81e876c
Compare
81e876c to
dcd5af1
Compare
|
@hieblmi, remember to re-request review from reviewers when ready |
f7565a9 to
4a124f3
Compare
4a124f3 to
a6b6846
Compare
8347df9 to
941c126
Compare
|
@starius: review reminder |
941c126 to
0ad07d7
Compare
dc2961f to
34cd8d2
Compare
9dc4039 to
7d29edd
Compare
Route existing HTLC, static address and reservation scripts through the same leaf serializers. Pin the quote templates so moving the serialization cannot change signed numbers or zero-hash fee estimates.
Define the key roles, cooperative and unilateral paths, witnesses and weight estimates for both directions. Exercise the legacy vectors and execute the spend conditions against the Bitcoin script engine.
Build the adapter against released pre-btcd-v2 modules and retain the bounded legacy TLV decoder. Map contracts into SDK plans and reuse the authenticated wallet connection. Define the shared runtime version floor and operation-scoped checks. Warn about older backends during daemon initialization while leaving ordinary payments and offline witness construction available.
Authenticate proof history, asset commitments, group issuances and Bitcoin inputs before granting on-chain authority. Apply the shared tapd floor at proof boundaries while keeping offline construction available. Distinguish invalid funding candidates from exact outputs waiting on confirmations or a chain backend. Preserve retryable results when no candidate is ready.
Prepare confirmed inputs for native Build and check its allocations, Bitcoin template, change policy and fee before granting authority. Verify wallet-funded fees again after native Commit.
Check signing policy and the saved package before using LND, and accept peer witnesses only for the approved transaction. Preserve durable recovery while ephemeral signing sessions remain caller-owned. Separate contract-input signing from finalization so wallet-funded callers can sign fee inputs before sealing the final anchor transaction.
Bind native compact paths to approved signed parents. After parents confirm, replace proof metadata with authenticated histories without altering the transaction or final witnesses.
Recover contract spends through native SDK packages and exact output proofs. Preserve the original contract descriptors, asset quantities and confirmation evidence across claims and refunds. Make publication retries consult exact archived proofs and the tapd transfer log before logging again. Report pending confirmations without creating duplicate transfer records or repeating their anchor fees.
Bind a recovery fallback package to the authenticated deposit before it is co-signed. The MuSig2 sighash covers the committed PSBT's own previous output, so a peer that changed only the signed input value or script obtained a valid signature that spent nothing real. Compare that prevout with the deposit output, reject a committed asset that carries its own lock time, and require normal broadcast. Verify a caller-provided asset witness commits to its input script key before declaring it to tapd, so a peer cannot bind a wallet script key to an unrelated internal key. Recognize a BIP-341 annex when matching the agreed leaf, reject an annex spend from reconstruction rather than mis-slicing its witness, report a reorg observed during outcome verification as retryable, and guard the observed-spend discovery helpers against a chain that returns a block without the watched spend.
7d29edd to
d620bd2
Compare
GustavoStingelin
left a comment
There was a problem hiding this comment.
Found no issues.
Provide shared contracts and SDK helpers for asset Loop In, asset Loop Out, and reservations.
swapkit/defines Bitcoin spending policies, signing roles, witnesses, and weights.swapkit/tapsdk/adapts those contracts to native tap-sdk transfer construction, checks independently agreed terms, binds signing to the approved package, and handles proofs and recovery. The consuming feature owns its state machine, persistence, Lightning deadlines, and decisions about releasing signatures or preimages.The implementation uses released tap-sdk v0.1.1 and Taproot Assets v0.8.8 on the pre-btcd-v2 dependency graph. New on-chain asset operations require a running tapd v0.8.8. The runtime gate accepts the released daemon's
0.8.8-alphaversion string and rejects v0.8.6, v0.8.7, and v0.8.8 release candidates. Consuming Go modules must repeat the bounded legacy TLV decoder replacement in Loop's go.mod, because Go does not inherit dependency replacements.All contracts have a cooperative MuSig2 path. Their unilateral refund policies are explicit:
NewDepositKitNewReservationKitNewSwapKit(SwapHTLCLegacyCSV)NewSwapKit(SwapHTLCStaticLoopInV3)/SwapHTLCCLTVBoth HTLC variants require the receiver's signature and the correct 32-byte preimage on success, with the existing one-block CSV. The reservation purchase flow in Loop #1229 preserves its quoted CSV delay by adapting
NewDepositKitwith explicit server/client key roles.NewReservationKitsupplies the separate CLTV policy.The default asset script descriptor preserves the fixed NUMS internal key and single
OP_TRUEleaf throughLegacyOPTrueOutput. The SDK supplied-key variant,SDKOPTrueOutput, requires explicit selection. Funded outputs retain their exact descriptors through spending and recovery.Review the nine commits in order. Each carries unit coverage for the behavior it introduces.
Package usage and validation boundaries are documented in the contract README and SDK adapter README.
Rebased on Loop master
9158aed2a. Unit tests for every package this PR touches passed locally ond620bd25aca7, the swapkit and proof/policy suites also under the race detector. Lint reported no findings in the files this PR touches, and the commit-message and module tidiness checks passed. CI for this head is running.Daemon-backed asset lifecycle tests live in Nautilus #1712. They cover the contracts, transfer and proof boundaries, and an explicitly selected SDK supplied-key OP_TRUE deposit-to-HTLC lifecycle. The server pins this head at
c0f4ef6d0. The fresh-key case (claim, HTLC timeout, and deposit timeout) and the deposit HTLC timeout sweep, kit restart recovery, recovery respend, passive asset, split transfer, reorg proof, and asset HTLC cases passed locally on tapd v0.8.8 on a build containing this head's kit changes, before its last rebase onto Loop master. Companion CI runs them on the pinned head.