Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blip-29: update RFQ messages #4

Open
wants to merge 1 commit into
base: tap-blip
Choose a base branch
from

Conversation

ffranr
Copy link

@ffranr ffranr commented Jul 24, 2024

This commit introduces several changes to the RFQ p2p messages. This includes version fields, group key asset specifiers, in/out assets, max volume, replacing rate tick with fixed-point, and adding a transfer type field.

This commit also modifies other RFQ sections such that they are in-line with these new RFQ message fields.

blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Show resolved Hide resolved
blip-tap.md Show resolved Hide resolved
Copy link

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice update! Left some comments for things I noticed while implementing the corresponding code changes.

blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
@ffranr ffranr force-pushed the rfq-msg-update branch 2 times, most recently from 638e0e9 to efca73f Compare September 13, 2024 13:31
@ffranr ffranr marked this pull request as ready for review September 13, 2024 13:31
@ffranr ffranr changed the title blip-29: update RFQ messages for current tapd state blip-29: update RFQ messages Sep 13, 2024
Copy link

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Very nice! Like the table structure, makes it more easy to parse. We're super close on this one.

blip-tap.md Show resolved Hide resolved
blip-tap.md Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
Copy link

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Questions around the TLV types, other than that looks good to me 🎉

blip-tap.md Outdated Show resolved Hide resolved
blip-tap.md Show resolved Hide resolved
blip-tap.md Outdated Show resolved Hide resolved
@ffranr ffranr force-pushed the rfq-msg-update branch 2 times, most recently from 3bcbefd to 6355a64 Compare September 17, 2024 15:55
This commit introduces several changes to the RFQ p2p messages. This
includes version fields, group key asset specifiers, in/out assets,
max volume, replacing rate tick with fixed-point, and adding a transfer
type field.

This commit also modifies other RFQ sections such that they are in-line
with these new RFQ message fields.
Copy link
Owner

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

Nice work!

Main comment is that we should make it clear that any instances of * or / are done using the fixed point operations. We can make a preliminary section, introduce the FixedPoint abstraction, and then the operations. From then on, we'd then implicitly refrences the fixed point operations with * and /.

| 11 | in_asset_group_key | 33*byte |
| 13 | out_asset_id | 32*byte |
| 15 | out_asset_group_key | 33*byte |
| 16 | max_transferable_in_asset | BigSize |
Copy link
Owner

Choose a reason for hiding this comment

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

Should we have a min as well?

Copy link
Author

Choose a reason for hiding this comment

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

As it stands, I don't believe we require or use a minimum. I'm not entirely clear on the value of having one, especially since the quote might not be used at all. A minimum volume doesn't seem to provide any protection for the edge node, and it appears to complicate MPP payments unnecessarily.

Could you please clarify the use case you had in mind?

blip-tap.md Show resolved Hide resolved
representation of the conversion rate.

When serialized into a wire message, the fixed-point number is represented as a
concatenation of its coefficient and scale fields: `<uint64><uint8>`.
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should expand this section with the update examples (send + recv) from the tapd docs: https://github.com/lightninglabs/taproot-assets/blob/main/docs/rfq-and-decimal-display.md#sell-order-paying-invoices. In particular the arithmetic operations needed to carry out the flows.

Copy link
Owner

Choose a reason for hiding this comment

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

I think we should also include either just to Go code or abstracted version to ensure that the div+mul operations are clear: https://github.com/lightninglabs/taproot-assets/blob/0d645983d10e0f944bad5e18b0cebeb47d31be3a/rfqmath/fixed_point.go#L75-L99

Copy link
Author

Choose a reason for hiding this comment

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

I think we should expand this section with the update examples (send + recv) from the tapd docs: https://github.com/lightninglabs/taproot-assets/blob/main/docs/rfq-and-decimal-display.md#sell-order-paying-invoices. In particular the arithmetic operations needed to carry out the flows.

Do the First Hop TAP HTLC Onion Processing and Last Hop TAP HTLC Onion Processing sections capture the examples that you were thinking of?

* `amt_to_forward = 1_633_054_326`
- MUST reject the payment if
```
amt_msat_to_forward > (amt_asset_incoming / incoming_asset_to_btc) * btc_to_msat_multiplier
Copy link
Owner

Choose a reason for hiding this comment

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

We should specify that all * and / operations are to be carried out using the FixedPoint abstraction. See comment above, I think we can add it as a prelimnary, then just use * and / as normal from there on.

`$61,234.95 = 1BTC`).

The user calculates the invoice amount as follows:
* `invoice_amt = (asset_amt / asset_to_btc_rate) * btc_to_msat_multiplier`
Copy link
Owner

Choose a reason for hiding this comment

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

Ah ok I see the example expanded on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants