Skip to content

lnwire_test: include onion message in lnwire Benchmark#10634

Open
Abdulkbk wants to merge 2 commits intolightningnetwork:masterfrom
Abdulkbk:om-fwding-tests
Open

lnwire_test: include onion message in lnwire Benchmark#10634
Abdulkbk wants to merge 2 commits intolightningnetwork:masterfrom
Abdulkbk:om-fwding-tests

Conversation

@Abdulkbk
Copy link
Copy Markdown
Contributor

@Abdulkbk Abdulkbk commented Mar 5, 2026

Change Description

In this PR, we include the OnionMessage message, introduced in #9868, in the existing Benchmark pipeline for lnwire messages.

We also fix some failing benchmarks caused by a malformed extraData TLV.

Steps to Test

go test -bench . -run=^$ ./lnwire 

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 lnwire message benchmarking suite by integrating the OnionMessage type, thereby broadening the scope of performance evaluations. Concurrently, it resolves existing benchmark failures by implementing a new utility function to generate correctly formatted TLV ExtraData, which improves the accuracy and stability of the benchmark results.

Highlights

  • Benchmarking: Included the OnionMessage type in the existing lnwire benchmark suite to ensure comprehensive performance testing for this message.
  • Benchmark Reliability: Fixed several failing benchmarks by replacing the generation of malformed extraData TLV with a new helper function that creates valid, canonically-ordered TLV streams.

🧠 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.

Changelog
  • lnwire/message_test.go
    • Added OnionMessage to the list of messages generated for benchmarking.
    • Introduced a new helper function createValidTLVExtraData to generate properly encoded TLV streams.
    • Replaced calls to createExtraData with createValidTLVExtraData in several message creation functions (newMsgInit, newMsgShutdown, newMsgUpdateAddHTLC, newMsgUpdateFulfillHTLC, newMsgCommitSig, newMsgChannelAnnouncement, newMsgNodeAnnouncement) to ensure valid TLV ExtraData.
    • Imported the tlv package.
    • Updated io.Reader parameters to *rand.Rand in newMsgInit and newMsgCommitSig functions.
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.

@lightninglabs-deploy lightninglabs-deploy added the severity-low Best-effort review label Mar 5, 2026
Copy link
Copy Markdown

@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 the OnionMessage to the lnwire benchmark suite. To support this and fix existing benchmark failures, it also introduces a new test helper createValidTLVExtraData to generate valid TLV data for message ExtraData fields, replacing the previous method that produced malformed data. The changes look good and address the stated goals. I have a couple of suggestions to improve the new test helpers.

@lightninglabs-deploy lightninglabs-deploy added severity-low Best-effort review and removed severity-low Best-effort review labels Mar 5, 2026
@Abdulkbk
Copy link
Copy Markdown
Contributor Author

@gijswijs when you have time take a look, it's a small diff 🙏

@gijswijs gijswijs self-requested a review March 27, 2026 16:49
Copy link
Copy Markdown
Collaborator

@gijswijs gijswijs left a comment

Choose a reason for hiding this comment

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

Only one comment from me.

records := make([]tlv.Record, 0, numRecords)
tlvType := tlv.Type(r.Intn(100) + 1)

for i := 0; i < numRecords; i++ {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use for i := range numRecords

That's what we prefer.

In this commit, we include onion message to the list of lnwire
messages for benchmark testing.
In this commit, we added createValidTLVExtraData which creates a
valid TLV data, and use it in place of createExtraData for messages
that their Encode or Decode requires validating the TLV data, which
were failing initially.
@lightninglabs-deploy
Copy link
Copy Markdown
Collaborator

@Abdulkbk, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants