Skip to content

Conversation

@ffranr
Copy link
Contributor

@ffranr ffranr commented Jan 8, 2026

Summary

  • Add AcceptedRate and OriginalRequest methods to the Accept interface for uniform access to accept message data
  • Introduce VerifyAcceptQuote method in InternalPortfolioPilot to validate expiry and price deviations for buy and sell accept messages
  • Streamline negotiator logic by delegating buy/sell accept validation to the PortfolioPilot

Implement `AcceptedRate` and `OriginalRequest` methods for `BuyAccept`
and `SellAccept` structs, updating the `Accept` interface to support
retrieving accepted rates and corresponding original requests.

This is a prep commit to provide uniform access to accept message data.
@ffranr ffranr added this to the v0.8 milestone Jan 8, 2026
@ffranr ffranr self-assigned this Jan 8, 2026
@ffranr ffranr added the RFQ Work relating to TAP channel Request For Quote (RFQ). label Jan 8, 2026
@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 refactors the Request for Quote (RFQ) system by centralizing the validation logic for accepted quotes. Previously, the Negotiator component performed these checks directly. Now, this responsibility is delegated to the PortfolioPilot, which is better suited for making financial decisions. This change improves modularity, makes the Negotiator simpler, and allows for more consistent and configurable validation rules by moving expiry and price deviation checks into the PortfolioPilot.

Highlights

  • Enhanced Accept Interface: Added AcceptedRate and OriginalRequest methods to the rfqmsg.Accept interface, providing uniform access to accepted quote data for validation across different accept message types.
  • Centralized Quote Validation: Introduced a new VerifyAcceptQuote method within the InternalPortfolioPilot to handle comprehensive validation of incoming buy and sell accept messages, including expiry checks and price deviation against oracle rates.
  • Streamlined Negotiator Logic: Refactored the Negotiator to delegate all incoming buy and sell accept message validation to the PortfolioPilot, significantly simplifying its HandleIncomingBuyAccept and HandleIncomingSellAccept methods by removing direct validation logic.
  • New Quote Response Statuses: Added PortfolioPilotErrQuoteRespStatus and ValidAcceptQuoteRespStatus constants to rfq/manager.go to better reflect the outcomes of the delegated validation process.
  • Configurable Validation Parameters: The InternalPortfolioPilotConfig now includes AcceptPriceDeviationPpm and MinAssetRatesExpiryLifetime to configure the validation parameters directly within the portfolio pilot, ensuring consistency.
  • Comprehensive Testing: Added extensive unit tests for the new VerifyAcceptQuote method in rfq/portfolio_pilot_test.go, covering various success and failure scenarios for both buy and sell accept messages.

🧠 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

This pull request is a solid refactoring that moves quote acceptance validation logic from the Negotiator to the PortfolioPilot, improving separation of concerns and code clarity. The new VerifyAcceptQuote method in PortfolioPilot correctly encapsulates the validation logic for both buy and sell accepts. The changes are well-tested with a new test suite for VerifyAcceptQuote. My main feedback concerns a change in error handling: errors from asynchronous validation are no longer propagated to the main error channel, which could mask potential issues. I've suggested restoring this behavior to ensure robust error handling.

@coveralls
Copy link

coveralls commented Jan 8, 2026

Pull Request Test Coverage Report for Build 20821737324

Details

  • 113 of 143 (79.02%) changed or added relevant lines in 5 files are covered.
  • 32 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+0.08%) to 57.057%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfq/portfolio_pilot.go 63 77 81.82%
rfq/negotiator.go 34 50 68.0%
Files with Coverage Reduction New Missed Lines %
address/mock.go 2 96.2%
asset/group_key.go 2 72.15%
rfq/negotiator.go 2 62.28%
tapdb/mssmt.go 2 90.45%
tapdb/sqlc/transfers.sql.go 2 83.33%
tapdb/universe.go 2 81.5%
universe/archive.go 2 79.22%
tapdb/assets_store.go 5 79.07%
mssmt/compacted_tree.go 6 77.65%
tapgarden/re-org_watcher.go 7 72.02%
Totals Coverage Status
Change from base Build 20795920245: 0.08%
Covered Lines: 65574
Relevant Lines: 114927

💛 - Coveralls

@ffranr ffranr force-pushed the wip/portfolio-pilot/validate-quote-accept branch 2 times, most recently from 0c6d33b to bf1e28d Compare January 8, 2026 14:55
ffranr added 3 commits January 8, 2026 15:17
Introduce a new method, `VerifyAcceptQuote`, in `InternalPortfolioPilot`
to validate expiry and price deviations for buy and sell accept
messages.
Streamline logic for handling buy and sell accept messages by delegating
expiry and price validation to the PortfolioPilot's `VerifyAcceptQuote`
method.
@ffranr ffranr force-pushed the wip/portfolio-pilot/validate-quote-accept branch from bf1e28d to 713b884 Compare January 8, 2026 15:17
@ffranr
Copy link
Contributor Author

ffranr commented Jan 8, 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 effectively refactors the quote acceptance logic by delegating validation to the PortfolioPilot interface. This centralization simplifies the Negotiator and improves code organization. The introduction of the VerifyAcceptQuote method is a clean abstraction, and the changes are well-supported by new and updated tests.

I've included a few minor suggestions to align the new code with the repository's style guide regarding comments.

@ffranr ffranr requested review from darioAnongba and jtobin January 8, 2026 15:41
@ffranr ffranr moved this from 🆕 New to 👀 In review in Taproot-Assets Project Board Jan 8, 2026
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.

🔥 🔥 🔥

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.

Lol, I accidentally entered my 🔥 🔥 🔥 comment in the wrong browser tab. Meant to approve 1936.. 😁

(Reviewing this one next!)

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.

LGTM (officially). 👍


## Functional Enhancements

- [PR#1935](https://github.com/lightninglabs/taproot-assets/pull/1935)
Copy link
Member

Choose a reason for hiding this comment

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

Something I thought about when looking at release notes lately is that we might be including too much information in them. This change, for example, isn't something I'd expect end users to particularly care about, as it's primarily an internal matter of organization.

It's more broadly a topic for another day, but just something I thought was worth commenting on.

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

Labels

RFQ Work relating to TAP channel Request For Quote (RFQ).

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

[feature]: PortfolioPilot - Outsourcing All Market and Portfolio-Related Decision-Making During RFQ

4 participants