Skip to content

itest: add channel capacity assertions#1198

Open
jtobin wants to merge 1 commit intolightninglabs:masterfrom
jtobin:capacity-check
Open

itest: add channel capacity assertions#1198
jtobin wants to merge 1 commit intolightninglabs:masterfrom
jtobin:capacity-check

Conversation

@jtobin
Copy link
Member

@jtobin jtobin commented Jan 13, 2026

Adds assertions that check a responder's view of channel capacity after funding. This should catch if passive assets have been included amongst the funding proofs (see lightninglabs/taproot-assets#1932).

@jtobin jtobin self-assigned this Jan 13, 2026
@jtobin jtobin added no-changelog This PR is does not require a release notes entry tests labels Jan 13, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @jtobin, 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 enhances the robustness of asset transfer mechanisms by introducing new validation steps in integration tests. These steps ensure that channel capacity is correctly perceived by the responder after funding, specifically targeting and preventing issues related to the erroneous inclusion of passive assets in funding proofs.

Highlights

  • New Assertions for Channel Capacity: Added assertions to integration tests (createTestAssetNetwork and createTestAssetNetworkGroupKey) to verify the responder's perspective of channel capacity after funding.
  • Preventing Passive Asset Inclusion: These new assertions aim to detect scenarios where passive assets might have been inadvertently included within funding proofs, addressing a known issue ([bug]: Incorrect Asset Channel Capacity Display taproot-assets#1932).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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

The pull request successfully adds assertions to the integration tests, specifically verifying the responder's view of channel capacity after funding. This directly addresses the goal of catching potential issues with passive assets being included in funding proofs, enhancing the robustness of the test suite. The changes are well-placed and consistent across the relevant test functions.

@jtobin jtobin marked this pull request as draft January 13, 2026 14:14
@jtobin
Copy link
Member Author

jtobin commented Jan 13, 2026

(Converting to draft as I haven't managed to trigger the condition in CI that I'm hoping to.)

@jtobin jtobin force-pushed the capacity-check branch 3 times, most recently from 5363035 to ad3fa85 Compare January 14, 2026 10:48
@jtobin jtobin marked this pull request as ready for review January 14, 2026 10:48
@jtobin
Copy link
Member Author

jtobin commented Jan 14, 2026

Ok, the new custom_channels_passive_assets icase should now fail in CI with an 'expected 1 funding asset, got 2' error. It should pass after lightninglabs/taproot-assets#1943 is merged.

@jtobin
Copy link
Member Author

jtobin commented Jan 14, 2026

/gemini review

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 adds an integration test to verify that passive assets are not incorrectly included in channel funding proofs, which could lead to an incorrect channel capacity on the responder's side. The new test, testCustomChannelsPassiveAssets, correctly sets up a scenario with a passive asset and asserts the responder's view of the channel capacity and funding assets.

The implementation is clear and the test case is relevant. I've found one potential issue regarding the test's robustness which could lead to flakiness, and I've left a suggestion to address it. Otherwise, the changes look good.

@jtobin
Copy link
Member Author

jtobin commented Jan 14, 2026

Note that this itest uses a group key to create a passive asset, whereas the user in lightninglabs/taproot-assets#1932 did not. It doesn't actually matter here, because the effect is the same -- it was just easier to construct an itest this way.

Adds a 'custom channels passive assets' icase asserting that passive
assets aren't included amongst the funding proofs sent to a responder.
@jtobin
Copy link
Member Author

jtobin commented Jan 30, 2026

(FYI this passes for taproot-assets's current 'main'.)

@lightninglabs-deploy
Copy link

@ffranr: review reminder
@jtobin, remember to re-request review from reviewers when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR is does not require a release notes entry tests

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

2 participants