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

Remove remaining instances of "rate tick" from RFQ systems #1156

Merged
merged 10 commits into from
Oct 22, 2024

Conversation

ffranr
Copy link
Contributor

@ffranr ffranr commented Oct 21, 2024

This PR removes any remaining mention of "rate tick" from the Price Oracle RPC endpoints and the RFQ packages.

@ffranr ffranr self-assigned this Oct 21, 2024
@ffranr ffranr requested review from guggero and GeorgeTsagk October 21, 2024 16:32
@ffranr
Copy link
Contributor Author

ffranr commented Oct 21, 2024

The remaining RFQ cleanup work after this PR is merge:

  • Add request message fields: suggestedOutAssetRate and transferType.
  • Rearrange fields in request message to correspond with BLIP (refactor only, no logic changes).

@coveralls
Copy link

coveralls commented Oct 21, 2024

Pull Request Test Coverage Report for Build 11447101930

Details

  • 19 of 35 (54.29%) changed or added relevant lines in 3 files are covered.
  • 29 unchanged lines in 9 files lost coverage.
  • Overall coverage decreased (-0.01%) to 40.424%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfq/negotiator.go 0 4 0.0%
rfqmsg/request.go 0 4 0.0%
rfq/oracle.go 19 27 70.37%
Files with Coverage Reduction New Missed Lines %
rfq/oracle.go 2 59.85%
tappsbt/create.go 2 53.22%
tapgarden/planter.go 2 74.87%
tapdb/addrs.go 2 79.04%
commitment/tap.go 3 84.7%
universe/interface.go 4 50.22%
tapdb/universe.go 4 80.91%
tapgarden/caretaker.go 4 68.5%
tapdb/assets_store.go 6 63.69%
Totals Coverage Status
Change from base Build 11446789576: -0.01%
Covered Lines: 24370
Relevant Lines: 60286

💛 - Coveralls

@ffranr ffranr changed the base branch from approved-rfq-fixedpoint to main October 21, 2024 19:01
@ffranr ffranr marked this pull request as ready for review October 21, 2024 19:01
//
// Example use case:
//
// Alice is trying to pay an invoice by spending an asset. Alice therefore
// requests that Bob (her asset channel counterparty) purchase the asset from
// her. Bob's payment, in BTC, will pay the invoice.
//
// Alice requests a bid quote from Bob. Her request includes a rate tick
// hint (ask). Alice get the rate tick hint by calling this endpoint. She sets:
// Alice requests a bid quote from Bob. Her request includes an asset rates hint
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Alice requests a bid quote from Bob. Her request includes an asset rates hint
// Alice requests a bid quote from Bob. Her request includes an asset-rate hint

Or are we referring to the name of the bundle, Asset Rates?

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 request includes an in-asset to BTC rate hint and an out-asset to BTC rate hint.

// Alice requests a bid quote from Bob. Her request includes a rate tick
// hint (ask). Alice get the rate tick hint by calling this endpoint. She sets:
// Alice requests a bid quote from Bob. Her request includes an asset rates hint
// (ask). Alice get the asset rates hint by calling this endpoint. She sets:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// (ask). Alice get the asset rates hint by calling this endpoint. She sets:
// (ask). Alice receives the asset rates hint by calling this endpoint. She sets:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've gone with "Alice obtains". Let me know if you think "receives" is better or something else.

Copy link
Collaborator

Choose a reason for hiding this comment

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

obtains sgtm

rfqmsg/accept.go Show resolved Hide resolved
Comment on lines +591 to +592
// Deprecated: Use QueryAssetRatesResponse.ProtoReflect.Descriptor instead.
func (*QueryAssetRatesResponse) Descriptor() ([]byte, []int) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be fully removed now? or are the motivations to preserve functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was auto-generated by our protos generator. It's probably in place for backwards compatibility. I think we can ignore this.

"properties": {
"subjectAssetRate": {
"$ref": "#/definitions/priceoraclerpcFixedPoint",
"description": "subjectAssetRate is the number of subject asset units per BTC represented\nas a fixed-point number. This field is also commonly referred to as the\nsubject asset to BTC (conversion) rate. When the subject asset is BTC\nmilli-satoshis (msats), this field should be set to 100 billion since\nthere are 100 billion msats in a BTC."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"description": "subjectAssetRate is the number of subject asset units per BTC represented\nas a fixed-point number. This field is also commonly referred to as the\nsubject asset to BTC (conversion) rate. When the subject asset is BTC\nmilli-satoshis (msats), this field should be set to 100 billion since\nthere are 100 billion msats in a BTC."
"description": "subjectAssetRate is the number of subject asset units per BTC represented\nas a fixed-point number. This field is also commonly referred to as the\nsubject asset to BTC (conversion) rate. When the subject asset is BTC\nmilli-satoshis (msats), this field should be set to 100 billion since\nthere are 100 billion msats per one bitcoin."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've gone with:

When the subject asset is BTC,
    // this field should be set to 100 billion, as one BTC is equivalent to 100
    // billion msats.

},
"paymentAssetRate": {
"$ref": "#/definitions/priceoraclerpcFixedPoint",
"description": "paymentAssetRate is the number of payment asset units per BTC represented\nas a fixed-point number. This field is also commonly referred to as the\npayment asset to BTC (conversion) rate. When the payment asset is BTC\nmilli-satoshis (msats), this field should be set to 100 billion since\nthere are 100 billion msats in a BTC."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"description": "paymentAssetRate is the number of payment asset units per BTC represented\nas a fixed-point number. This field is also commonly referred to as the\npayment asset to BTC (conversion) rate. When the payment asset is BTC\nmilli-satoshis (msats), this field should be set to 100 billion since\nthere are 100 billion msats in a BTC."
"description": "paymentAssetRate is the number of payment asset units per BTC represented\nas a fixed-point number. This field is also commonly referred to as the\npayment asset to BTC (conversion) rate. When the payment asset is BTC\nmilli-satoshis (msats), this field should be set to 100 billion since\nthere are 100 billion msats per one bitcoin."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've gone with:

When the payment asset is BTC,
    // this field should be set to 100 billion, as one BTC is equivalent to 100
    // billion msats.

Comment on lines -216 to +235
"description": "QueryRateTickErrResponse is the error response to a rate tick query."
},
"priceoraclerpcQueryRateTickResponse": {
"type": "object",
"properties": {
"success": {
"$ref": "#/definitions/priceoraclerpcQueryRateTickSuccessResponse",
"description": "success is the successful response to the rate tick query."
},
"error": {
"$ref": "#/definitions/priceoraclerpcQueryRateTickErrResponse",
"description": "error is the error response to the rate tick query."
}
},
"description": "QueryRateTickResponse is the response to a rate tick query."
"description": "QueryAssetRatesErrResponse is the error response to a QueryAssetRates call."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the range of responses reduced s.t. QueryAssetRatesErrResponse encapsulates everything?

Copy link
Contributor Author

@ffranr ffranr Oct 21, 2024

Choose a reason for hiding this comment

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

QueryAssetRatesErrResponse encapsulates all error responses from a price oracle service QueryAssetRates endpoint call. QueryAssetRatesErrResponse does not encapsulate every kind of response. We also have QueryAssetRatesOkResponse.

ffranr added 10 commits October 21, 2024 20:14
This commit removes the "rate tick" concept from the price oracle RPC
and replaces it with an asset units per BTC rate, using the new
fixed-point type.

This commit focuses on RPC changes. Other instances of "rate tick" will
be removed in subsequent commits.
This commit removes the "rate tick" concept from the price oracle basic
example.
Rename variables, constants, and uses in comments.
@ffranr ffranr requested a review from dstadulis October 21, 2024 19:23
Copy link
Member

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

LGTM 🎉

Copy link
Collaborator

@dstadulis dstadulis left a comment

Choose a reason for hiding this comment

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

Thanks for the modifications!

@dstadulis dstadulis added this to the v0.4.2 milestone Oct 22, 2024
@dstadulis dstadulis added the rfq label Oct 22, 2024
@ffranr ffranr added this pull request to the merge queue Oct 22, 2024
Merged via the queue into main with commit eeadc03 Oct 22, 2024
18 checks passed
@guggero guggero deleted the rfq-rm-rate-tick branch October 22, 2024 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants