Skip to content

Conversation

@ffranr
Copy link
Contributor

@ffranr ffranr commented Dec 4, 2025

This PR strengthens tapd startup guarantees and fixes the flake in the unknown_TLV_type itest.

Key points

  • HTLC interceptor setup failures now cause tapd to exit rather than continue in a degraded state. This ensures that a running tapd instance always has a functioning RFQ subsystem.
  • The itest flake was caused by two tapd instances sharing the same lnd backend, competing for a single HTLC interceptor. The test now gives Charlie its own lnd node, eliminating the conflict.

@ffranr ffranr self-assigned this Dec 4, 2025
@ffranr ffranr added error handling itests flake RFQ Work relating to TAP channel Request For Quote (RFQ). labels Dec 4, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @ffranr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the stability and reliability of the tapd daemon by ensuring that critical components, specifically the HTLC interceptor, are properly initialized. If setup fails, tapd will now gracefully exit rather than operating in a compromised state. Additionally, it addresses a persistent flake in an integration test by isolating lnd backend resources, preventing resource contention and improving test determinism.

Highlights

  • Robust HTLC Interceptor Setup: HTLC interceptor setup failures will now cause tapd to exit, preventing it from running in a degraded state and ensuring the Request-for-Quote (RFQ) subsystem is always functional.
  • Integration Test Flake Resolution: The unknown_TLV_type integration test flake has been fixed by providing a dedicated lnd backend for the 'Charlie' tapd instance, resolving a conflict where two tapd instances were competing for a single HTLC interceptor.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@GeorgeTsagk GeorgeTsagk self-requested a review December 4, 2025 16:01
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request strengthens tapd startup guarantees by making HTLC interceptor setup failures critical, which now causes the daemon to exit. This is a good improvement to ensure the RFQ subsystem is always functional when tapd is running. The change is implemented by propagating an error channel to the OrderHandler and reporting the setup failure as a critical error. Additionally, the PR fixes an integration test flake by providing a dedicated lnd node to a tapd instance, which correctly resolves the resource conflict. The changes are well-reasoned and correctly implemented. I have a couple of minor suggestions to improve code comments and style guide adherence.

@ffranr ffranr force-pushed the wip/improve-htlc-intercept-setup-error-handling branch from 7bdc231 to b044d92 Compare December 4, 2025 16:13
@ffranr ffranr moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Dec 4, 2025
Previously, Charlie's tapd node shared an LND node with Bob's tapd node.
This caused flakes when setting up the RFQ HTLC interceptor in each tapd
node.
@ffranr ffranr force-pushed the wip/improve-htlc-intercept-setup-error-handling branch 2 times, most recently from 31b06d7 to 952be70 Compare December 4, 2025 16:25
@ffranr
Copy link
Contributor Author

ffranr commented Dec 4, 2025

This PR should fix this sort of flake:

        tapd_harness.go:336: Using proof courier address: universerpc://127.0.0.1:10259
        test_harness.go:137: Failed: (unknown TLV type): exited with error: 
            *errors.errorString Error running server: unable to initialize RPC server: unable to start RFQ manager: unable to start RFQ order handler: unable to setup incoming HTLC interceptor: rpc error: code = Unknown desc = interceptor already exists
            /home/runner/work/taproot-assets/taproot-assets/itest/tapd_harness.go:458 (0x2505552)
            	(*tapdHarness).start.func2: hs.ht.Fatalf("Error running server: %v", err)
            /opt/hostedtoolcache/go/1.24.9/x64/src/runtime/asm_amd64.s:1700 (0x4823a1)
            	goexit: BYTE	$0x90	// NOP
        test_harness.go:461: 
            	Error Trace:	/home/runner/work/taproot-assets/taproot-assets/itest/test_harness.go:461
            	            				/home/runner/work/taproot-assets/taproot-assets/itest/addrs_test.go:811
            	            				/home/runner/work/taproot-assets/taproot-assets/itest/test_harness.go:160
            	            				/home/runner/work/taproot-assets/taproot-assets/itest/integration_test.go:131
            	Error:      	Received unexpected error:
            	            	error waiting for server to start: dial tcp 127.0.0.1:10354: connect: connection refused
            	Test:       	TestTaprootAssetsDaemon/tranche01/15-of-100/unknown_TLV_type
    harness_miner.go:149: Mined 0 blocks when cleanup the mempool

https://github.com/lightninglabs/taproot-assets/actions/runs/19930326488/job/57140421069

@coveralls
Copy link

coveralls commented Dec 4, 2025

Pull Request Test Coverage Report for Build 19979510397

Details

  • 14 of 16 (87.5%) changed or added relevant lines in 2 files are covered.
  • 32 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+0.06%) to 56.658%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfq/order.go 13 15 86.67%
Files with Coverage Reduction New Missed Lines %
asset/group_key.go 2 72.15%
commitment/tap.go 2 85.42%
lndservices/block_header_cache.go 2 97.52%
mssmt/compacted_tree.go 2 78.11%
tapdb/universe.go 2 81.27%
tapgarden/custodian.go 2 77.39%
itest/multisig.go 3 97.94%
tapchannel/aux_leaf_signer.go 3 43.53%
tapdb/multiverse.go 6 80.16%
tapgarden/caretaker.go 8 76.63%
Totals Coverage Status
Change from base Build 19960793390: 0.06%
Covered Lines: 64900
Relevant Lines: 114546

💛 - Coveralls

Copy link
Member

@jtobin jtobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question about the new ErrChan, otherwise LGTM. 👍 👍

Handle failed HTLC intercept setup attempts as critical errors to
ensure issues are surfaced promptly.
@ffranr ffranr force-pushed the wip/improve-htlc-intercept-setup-error-handling branch from 952be70 to 450304d Compare December 6, 2025 00:06
@ffranr ffranr requested a review from jtobin December 6, 2025 00:07
@ffranr ffranr moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board Dec 6, 2025
Copy link
Member

@jtobin jtobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🚢

@GeorgeTsagk GeorgeTsagk added this pull request to the merge queue Dec 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 8, 2025
@GeorgeTsagk GeorgeTsagk added this pull request to the merge queue Dec 8, 2025
Merged via the queue into main with commit cfee1c8 Dec 8, 2025
27 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Taproot-Assets Project Board Dec 8, 2025
@ffranr ffranr deleted the wip/improve-htlc-intercept-setup-error-handling branch December 8, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error handling flake itests RFQ Work relating to TAP channel Request For Quote (RFQ).

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants