Repository navigation
Conversation
There was a problem hiding this comment.
Taproot Assets compatibility
Please bump github.com/lightninglabs/taproot-assets to v0.8.1. This PR already handles its updated rfqmath.UnitsToMilliSatoshi signature, and the bump keeps Loop compatible with litd versions using tapd v0.8.1.
Since v0.8.1 still uses the legacy btcd packages, Loop needs the temporary btcd-v2 replacement. Go does not propagate replace directives to downstream modules, so LiT needs the same replacement until a btcd-v2-compatible Taproot Assets release is available. Please re-run the LiT compatibility jobs with that setup.
Port the coordinated source migration from Loop lightninglabs#1199 while keeping Go 1.27.3 and the existing runtime lnd floor. Pin current lnd master and matching submodules, tapd v0.8.6's v2 compatibility revision, and the SDK fixes for proof selection, signing, and activation APIs. Propagate immutable replacements into LoopRPC and LiT compatibility builds because dependency replacements are not inherited. Co-authored-by: Boris Nagaev <bnagaev@gmail.com>
Port the coordinated source migration from Loop lightninglabs#1199 while keeping Go 1.27.3 and the existing runtime lnd floor. Pin current lnd master and matching submodules, tapd v0.8.6's v2 compatibility revision, and the SDK fixes for proof selection, signing, and activation APIs. Propagate immutable replacements into LoopRPC and LiT compatibility builds because dependency replacements are not inherited. Co-authored-by: Boris Nagaev <bnagaev@gmail.com>
Port the coordinated source migration from Loop lightninglabs#1199 while keeping Go 1.27.3 and the existing runtime lnd floor. Pin current lnd master and matching submodules, tapd v0.8.6's v2 compatibility revision, and the SDK fixes for proof selection, signing, and activation APIs. Propagate immutable replacements into LoopRPC and LiT compatibility builds because dependency replacements are not inherited. Co-authored-by: Boris Nagaev <bnagaev@gmail.com>
Port the coordinated source migration from Loop lightninglabs#1199 while keeping Go 1.27.3 and the existing runtime lnd floor. Pin current lnd master and matching submodules, tapd v0.8.6's v2 compatibility revision, and the SDK fixes for proof selection, signing, and activation APIs. Propagate immutable replacements into LoopRPC and LiT compatibility builds because dependency replacements are not inherited. Co-authored-by: Boris Nagaev <bnagaev@gmail.com>
Loop Out accepts only P2PKH, P2SH, P2WPKH, P2WSH and P2TR destination addresses. Instant Out and the autoloop destination accepted any type that the address decoder returns, which for Instant Out included raw public keys. The btcd v2 address package also decodes pay-to-anchor addresses, which anyone can spend. Move the Loop Out check into utils.IsSupportedDestAddr. Apply it to Instant Out before the swap starts and to the autoloop parameters when they are validated, so that a decoder change can't widen the accepted destination types.
RpcToParameters decoded the autoloop destination address with nil chain parameters. For P2PKH and P2SH addresses and raw public keys, the decoder dereferences the parameters, so a SetLiquidityParams call with such an address panicked. loopd does not recover from panics in RPC handlers, so the daemon crashed. Pass the chain parameters of the active network to RpcToParameters and decode the address with them. A raw public key now decodes and fails the destination type check.
Loop Out rejects a destination address that does not belong to the active network. Autoloop, Instant Out, static address withdrawals and manual HTLC sweeps did not. The decoder accepts bech32 addresses of all known networks, and their output scripts don't depend on the network, so these paths paid to the same witness program on the active network. Add utils.CheckAddrNetwork and call it after each of these decodes. Earlier versions saved the autoloop destination without the check. If the saved destination belongs to another network, loopd removes it at startup and autoloop pays to wallet addresses, because failing to start would leave no way to change the parameters.
Update LND, Aperture, and Taproot Assets to revisions using the btcd v2 modules, and update lndclient to v0.21.0-3. Migrate Loop chain, transaction, and address types to their corresponding v2 packages. The lndclient release includes the migration from: lightninglabs/lndclient#280 Taproot Assets is temporarily replaced with its btcd v2 revision because the v0.8 release branch has not adopted the new modules. The v2 address decoder also accepts pay-to-anchor addresses. The destination type checks reject them, and tests now cover this case. This changes exported address types.
Use Go's normal module proxy configuration for all four tidy checks. This avoids concurrent direct VCS fetch failures in CI and removes the redundant selective prefetch. Keep checksum verification and the final working-tree consistency check.
This was addressed in the October 21 revision, with v0.8.6 in place of v0.8.1. Loop requires I rebased the PR onto current master (Go 1.27.3) and migrated the code master added since then. That code includes the two The rebase also adds a commit before the migration. Go 1.27.3 now flags |
multi: migrate to btcd v2 modules
Migrate Loop to the btcd v2 modules, rebased onto the current master (Go 1.27.3). Exported Bitcoin address, transaction, hash, script, and chain types now use the corresponding v2 packages. Preserve the current swap-fee, withdrawal, and minimum-runtime-lnd behavior while updating the dependency graph.
Use released lndclient v0.21.0-3, the v2-compatible lnd and Aperture revisions, and the matching wallet and chain modules. Keep Taproot Assets on the fixed v0.8.6 code with a v2 compatibility migration rather than switching to main's different API and incomplete v0.8.6 fix set.
Use lnd revision f2963ce1fd19, which contains the released v0.21.4 forwarding-response recovery and replay fixes, rather than the older v2 snapshot. Align the SQL, queue, and result-helper modules with that revision.
The rebase also migrates the code master added since the previous revision: blinded loop-out invoices, static loop-in store tests, withdrawal and deposit hold tests, PostgreSQL pool tests, and sweep batcher retry tests. The previous CI run failed because two of those tests still called
btcutil.DecodeAddress; they now useaddress/v2. Master already requires Go 1.27.3, so this PR no longer changes the Go version.The v2 address decoder also accepts pay-to-anchor addresses, which anyone can spend; the old decoder rejected them. Loop Out already limited destinations to P2PKH, P2SH, P2WPKH, P2WSH and P2TR, but Instant Out and the autoloop destination relied on the decoder. The first commit moves the Loop Out check into a shared helper and applies it to both, before the migration, so that no commit accepts such a destination. Instant Out now also rejects raw public keys, as Loop Out does. Static address withdrawals and manual HTLC sweeps already rejected these types when estimating the transaction weight.
The next two commits fix destination bugs that master also has. loopd decoded the autoloop destination without chain parameters, so setting it to a P2PKH or P2SH address or a raw public key crashed the daemon; the address is now decoded for the active network. Autoloop, Instant Out, static address withdrawals and manual HTLC sweeps also accepted addresses of other networks, which Loop Out rejects; they now reject them too. If the saved autoloop destination belongs to another network, loopd removes it at startup instead of failing to start. Both commits come before the migration and apply to master unchanged.
Module checks honor the configured Go proxy to avoid Git cache fetch races, while retaining all four tidy checks and the failure on a modified working tree.
Companion migrations
b660f02("db: declare mapped SQL errors on the pointer receiver"); the pinned revision predates it.Temporary fork replacements pin immutable source revisions. Before release, replace these with accepted upstream revisions or tags. Review and land Taproot Assets first; then Loop and its RPC modules; then LiT. Tagged shared dependencies and subservers can be adopted at each stage.
Replace directives apply only in the main module. Until lnd and Taproot Assets publish btcd v2 versions, modules that import Loop's root module must mirror its lnd, sqldb and Taproot Assets replacements, as LiT #1438 does. Without the lnd and Taproot Assets replacements the build fails, because their released versions import btcd packages that btcd v0.26.0 no longer contains. The lnd revision cannot be required directly, because its pseudo-version sorts below the v0.21.3-beta release.
looprpcandswapserverrpcare unchanged and keep their current dependencies.Validation
make unit-race,make unit-postgres-race, all packages);go vet ./...; golangci-lint v2.15.0 with the repository configuration (0 issues); tidy checks for all four modules;make build tags=dev;make rpc-js-compile; generated CLI docs check; commit message lint; release note check. Each commit with Go changes builds and vets on its own. The destination tests fail when the shared type or network check accepts every address, when the autoloop destination is decoded without chain parameters, and when a saved destination of another network is not removed at startup.rpc-checkandsqlc-checkwere not rerun, since this PR does not change protos or SQL. In the SQLite race suite,TestSweepBatcherCloseDuringAddingsometimes exceeds its 5 s test guard; it does the same on master, and the rest ofsweepbatcherpasses.0203039, plusb660f02from LiT master, with Loop and both RPC modules replaced by this branch. The build with LiT's compile tags andmake unitpass. Withoutb660f02, thesessionpackage fails vet under Go 1.27.3. The LiT itests were not rerun locally.Keep this draft while the coordinated dependency migrations are reviewed and the temporary pins are replaced. The btcd v2 import changes affect Go callers; the runtime lnd minimum remains v0.19.0-beta, based on the actual RPC behavior Loop requires.
Pull Request Checklist
docs/release-notes/release-notes-next.md, or apply theno-changeloglabel.