-
Notifications
You must be signed in to change notification settings - Fork 126
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
Part 2: RFQ uses fixed-points #1141
Conversation
9b6917f
to
3433947
Compare
Pull Request Test Coverage Report for Build 11350535264Details
💛 - Coveralls |
3433947
to
205adbe
Compare
aa53ed4
to
c5a94c3
Compare
c5a94c3
to
8825621
Compare
205adbe
to
0142f31
Compare
In the latest commits pushed to this PR: RFQ wire message uses |
@GeorgeTsagk @guggero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good! Pretty much just the same comments as in part 1 (use of 0 for the scale). Once that's resolved, this should be ready quite quickly. Great work!
3a37e87
to
eeeb198
Compare
This commit modifies the AssetPurchasePolicy struct to carry the asset-to-BTC rate instead of a "price". It also updates the policy check equations to use the new rate field.
Introduce `BigInt.Bytes` and `BigInt.FromBytes` methods for encoding and decoding `BigInt` in RFQ wire messages.
This will be used for serializing fixed-points in wire messages.
0142f31
to
a6e3c35
Compare
I've rebased this PR on to the merged approved part 1 PR approved-rfq-fixedpoint. |
This commit updates the RFQ request wire message, renaming the `SuggestedRateTick` field to `SuggestedAssetRate` and changing its type to a fixed-point representation.
This commit replaces the RFQ accept wire message fields InOutRateTick and OutInRateTick with InAssetRate and OutAssetRate. The new fields represent the incoming asset-to-BTC rate and the outgoing asset-to-BTC rate, respectively.
Modify TLV type integers to match the latest BLIP state.
Update the minimum supported accept wire message version to 1. Adjust the version check logic to ensure that only version 1 is accepted, and not any version greater than 0.
a6e3c35
to
ba84cfc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress, LGTM 🎉
Update TLV type integers to align with the latest BLIP state. Some integer values are intentionally skipped to reserve space for new fields defined in the BLIP.
Update the minimum supported request wire message version to 1. Adjust the version check logic to ensure that only version 1 is accepted, and not any version greater than 0.
ba84cfc
to
a14d21d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done!
LGTM 👑
// IntoBigIntFixedPoint converts the TlvFixedPoint to a BigIntFixedPoint. | ||
func (f *TlvFixedPoint) IntoBigIntFixedPoint() rfqmath.BigIntFixedPoint { | ||
return rfqmath.BigIntFixedPoint{ | ||
Coefficient: f.fp.Coefficient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explicitly copy over the Coefficient
here?
Depends on #1136.
Merge #1136 first. This PR will be in draft until then.
The high-level goal of this change is to represent asset-to-BTC conversion rates using the new fixed-point number type. This PR updates several "price" related fields that were previously typed as milli-satoshis, which were used as a workaround in the Proof of Concept (PoC).
Remaining changes after this PR has been merged:
suggestedOutAssetRate
andtransferType
.