Skip to content

Conversation

@darioAnongba
Copy link
Contributor

@darioAnongba darioAnongba commented Nov 3, 2025

RFQ buy/sell accepts are now written to the database (rfq_policies table) whenever a policy is agreed, giving us an audit trail and keeping quotes across restarts.

The OrderHandler reloads these rows at startup to rebuild policies and the manager repopulates its in-memory caches from the same data.

Added a check in itest that restarts Bob’s tapd mid RFQ flow and verifies the quote remains available to Carol.

Fixes #855

@darioAnongba darioAnongba self-assigned this Nov 3, 2025
@darioAnongba darioAnongba changed the base branch from main to 0-8-0-staging November 3, 2025 14:45
@coveralls
Copy link

coveralls commented Nov 3, 2025

Pull Request Test Coverage Report for Build 19640788309

Details

  • 429 of 564 (76.06%) changed or added relevant lines in 5 files are covered.
  • 59 unchanged lines in 17 files lost coverage.
  • Overall coverage increased (+0.1%) to 56.74%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapdb/sqlc/rfq.sql.go 53 61 86.89%
rfq/manager.go 11 27 40.74%
rfq/order.go 57 86 66.28%
tapdb/rfq_policies.go 301 383 78.59%
Files with Coverage Reduction New Missed Lines %
fn/context_guard.go 1 91.94%
asset/asset.go 2 80.21%
asset/group_key.go 2 72.15%
mssmt/compacted_tree.go 2 78.11%
tapdb/mssmt.go 2 90.45%
tapdb/sqlc/mssmt.sql.go 2 48.34%
tapdb/sqlc/universe.sql.go 2 73.71%
tapdb/universe.go 2 80.58%
asset/mock.go 3 73.21%
itest/multisig.go 3 97.94%
Totals Coverage Status
Change from base Build 19640483961: 0.1%
Covered Lines: 65028
Relevant Lines: 114606

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 19038516198

Details

  • 425 of 603 (70.48%) changed or added relevant lines in 5 files are covered.
  • 507 unchanged lines in 39 files lost coverage.
  • Overall coverage decreased (-0.3%) to 56.265%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfq/manager.go 14 21 66.67%
tapdb/sqlc/rfq.sql.go 58 74 78.38%
rfq/order.go 28 72 38.89%
tapdb/rfq_policies.go 318 429 74.13%
Files with Coverage Reduction New Missed Lines %
proof/courier.go 1 78.88%
asset/asset.go 2 79.97%
asset/group_key.go 2 72.15%
fn/func.go 2 58.82%
tapdb/assets_common.go 2 77.97%
tapdb/migrations.go 2 76.19%
tapdb/sqlc/mssmt.sql.go 2 47.02%
tapdb/sqlc/transfers.sql.go 2 82.65%
tapdb/universe_federation.go 2 88.55%
tapdb/universe.go 2 80.35%
Totals Coverage Status
Change from base Build 18942913401: -0.3%
Covered Lines: 64373
Relevant Lines: 114410

💛 - Coveralls

@darioAnongba darioAnongba force-pushed the feat/persist-rfq branch 2 times, most recently from 98bcb62 to 5a2bd52 Compare November 3, 2025 15:17
@darioAnongba darioAnongba marked this pull request as ready for review November 3, 2025 15:17
@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Nov 3, 2025
@levmi levmi added this to the v0.8 milestone Nov 3, 2025
Copy link
Member

@GeorgeTsagk GeorgeTsagk left a comment

Choose a reason for hiding this comment

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

Just a few nits, will do a final pass soon

@darioAnongba darioAnongba moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board Nov 17, 2025
Copy link
Member

@GeorgeTsagk GeorgeTsagk left a comment

Choose a reason for hiding this comment

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

Looking good, dropped a few more comments

// lightning node.
scid := msg.ShortChannelId()
m.peerAcceptedBuyQuotes.Store(scid, msg)
m.orderHandler.peerAcceptedBuyQuotes.Store(scid, msg)
Copy link
Member

Choose a reason for hiding this comment

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

why are we moving the maps to orderHandler if we end up calling them again from rfq.Manager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is that all these maps represent an in-memory store. The business layer does not care how the data is stored (it can be an in-memory cache, a Redis cache, a DB, etc). And we should ideally be able to switch between infras without changing the business.

We currently split these maps into the Manager and the OrderHandler. The idea we discussed with @ffranr is to move everything to the OrderHandler for now in a simple refactor in this PR, and then eventually move everything to tapdb (in a QuoteStore or PolicyStore).

Now, about this line: m.orderHandler.peerAcceptedBuyQuotes.Store(scid, msg). I agree it's ugly and I also don't like it so I could expose functions from the orderHandler like m.orderHandler.StoreBuyQuote(), equivalent to the future m.quoteStore.StoreBuyQuote() WDYT?

@darioAnongba darioAnongba changed the base branch from 0-8-0-staging to main November 24, 2025 10:11
@jtobin jtobin removed their request for review November 25, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

[feature]: Persist agreed quotes in RFQ service

6 participants