-
Notifications
You must be signed in to change notification settings - Fork 111
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
ASN.1: Add final ILP Payment Packet format (and drafts of ILQP packets) #168
Conversation
5079410
to
05bbe3a
Compare
Also includes draft of ILQP formats.
05bbe3a
to
9716fb7
Compare
AUTOMATIC TAGS ::= | ||
BEGIN | ||
|
||
IMPORTS |
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.
Can drop all but UInt64 from IMPORTS as they are not used
@@ -2,40 +2,76 @@ InterledgerQuotingProtocol DEFINITIONS AUTOMATIC TAGS ::= | |||
BEGIN | |||
|
|||
IMPORTS |
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.
Can drop all but UInt32 and UInt128 from IMPORTS as they are not used
|
||
InterledgerProtocolPaymentMessage ::= SEQUENCE { | ||
-- Amount which must be received at the destination | ||
amount UInt64, |
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.
Use Amount type?
BEGIN | ||
|
||
IMPORTS | ||
UInt64 |
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.
Don't import from GenericTypes. Use Amount type instead of UInt64
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.
I was thinking about that. If there is an amount type, we should use it everywhere obviously. But if Amount
is just UInt64
I think it's more readable if we just put UInt64
everywhere. For complex types, sure, define it once. But if it's just a primitive type, don't make me go to another file just to find out what it is. What do you think?
BEGIN | ||
|
||
-- Small Integers | ||
Int8 ::= INTEGER (-128..127) |
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.
Do we need all of these types anymore? I appreciate the value of the comments for documenting how the design was finalized but perhaps we can put that somewhere else to keep this clean?
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.
I like having a full suite of generic types, in case we need them in the future. And I like having them in the repo to avoid external dependencies. So my vote is to keep this. It's in a separate file, so I don't see how it would be distracting.
asn1/InterledgerQuotingProtocol.asn
Outdated
-- amounts) for the quoted route | ||
liquidity LiquidityCurve, | ||
-- Common prefix of all addresses for which this liquidity curve applies | ||
-- SHOULD end with a period "." (but clients MUST NOT enforce this) |
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.
I agree but this seems like a bit of an odd thing to say so it might be worth providing more rationale or linking to the ILP addresses spec
asn1/InterledgerQuotingProtocol.asn
Outdated
destinationPrefix Address, | ||
-- How long the sender should put money on hold (in milliseconds) | ||
sourceHoldDuration UInt32 | ||
-- TODO: An exact quote expiry doesn't seem necessary... |
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.
Why not? If a connector is giving you a liquidity curve, wouldn't you want them to tell you how long you can use it for? If a sender gets a liquidity curve they might be tempted to cache it for a very long time as they send repeated streaming payments.
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.
Will change to include expiry date.
asn1/InterledgerQuotingProtocol.asn
Outdated
-- provided in the request. | ||
requestedAmount Amount, | ||
sourceHoldDuration IlpHoldDuration | ||
-- Quote with a specific source or destination amount |
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.
I think this comment predates switching to having two different messages for quote source and quote destination
asn1/InterledgerQuotingProtocol.asn
Outdated
destinationAccount Address, | ||
sourceAmount Amount, | ||
-- How much time the receiver needs to fulfill the payment (in milliseconds) | ||
destinationHoldDuration UInt32 |
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.
What if the sender doesn't know this but does know how long they're willing to put funds on hold for? We might want to suggest some default value in case that isn't known.
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.
Not sure if we should care about that use case. You will always want to hold it for the minimum amount of time. If you don't know how long the recipient needs, you can probably make a reasonable guess or just ask them.
It just doesn't make much sense why you would choose the destination hold based on the sender's willingness to hold. It's like buying paint based on how much they have at the store instead of estimating how much you need.
| "A".."Z" | ||
| underscore | ||
| "a".."z" | ||
| tilde ) |
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.
Really not very important, but why are the categories ordered in this way? I would expect alphanumeric characters to come before the symbols
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.
They are ordered by value, i.e. their order in the ASCII table. E.g. 'A' == 0x41
, so it comes before '_' == 0x5F
, which in turn comes before 'a' == 0x61
asn1/InterledgerTypes.asn
Outdated
|
||
Amount ::= UInt64 | ||
|
||
-- Selection of other options considered: |
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.
I think this can be taken out
asn1/InterledgerTypes.asn
Outdated
|
||
-- -------------------------------------------------------------------------- | ||
|
||
-- Different ledgers may use different rounding parameters |
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.
Can this section be taken out?
asn1/InterledgerTypes.asn
Outdated
-- | ||
-- The only amounts | ||
|
||
LiquidityCurve ::= SEQUENCE OF SEQUENCE { |
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.
Why do we call this a liquidity curve instead of a rate curve?
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.
The rate is the slope of this curve, so the "rate curve" would be the derivative of this curve. Open to another name if anyone has ideas.
asn1/InterledgerTypes.asn
Outdated
-- output amount. Each point must have larger x and y values than the previous | ||
-- point. All coordinates must be greater than zero. | ||
-- | ||
-- The only amounts |
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.
Oh the suspense! "The only amounts"...what?
asn1/InterledgerTypes.asn
Outdated
-- Liquidity curves describe the relationship between input and output amount | ||
-- for a given path between a given pair of ledgers. | ||
-- | ||
-- The curve is expressed as a series of points given as <x, y> coordinates. |
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.
If x
and y
need to be explained in this context, what do you think about just renaming them to something like inputAmount
and outputAmount
?
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.
I can barely read ASN.1, but what I saw mostly makes sense. Agree w/ @adrianhopebailie and @emschwartz about removing more stuff that's apparently unused. Otherwise, looks fine?
Address ::= IA5String | ||
(FROM | ||
( hyphen | ||
| period |
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 this definition include the rule that segments cannot be zero-length—that is, you cannot have ..
in an ILP address?
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.
I don't think that's possible in ASN.1, but am happy to be proven wrong by someone with better ASN.1-fu.
asn1/InterledgerTypes.asn
Outdated
-- The curve is expressed as a series of points given as <x, y> coordinates. | ||
-- | ||
-- Each x coordinate corresponds to an input amount, each y corresponds to an | ||
-- output amount. Each point must have larger x and y values than the previous |
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.
Are you sure both x and y have to be larger? Can you not have a "curve" that plateaus in the middle, e.g.:
y₃ ┨ ╭┄
┃ ╱
┃ ╱
y₁,y₂ ┨ ╭╌╌╌╯
┃ ╱
y₀ ┨╯
┗━━┳━━━┳━━┳━━
x₀ x₁ x₂ x₃
(in this case y₁=y₂ but x₂>x₁)
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.
In that case, the price is zero/infinity. My initial intuition was that that could result in some mathematical funkiness. But I haven't been able to think of a case. In crypto, you always disallow zero basically everywhere, so it's become my default habit.
The current implementation does allow equal y coordinates, but no equal x coordinates. That means that inverting a curve may give you an invalid curve. Not sure if that matters since we don't really invert curves.
I'd be ok to write what the current implementation does into the spec, but would caution us to think about this point some more.
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.
I think it makes sense that you may have a plateau in the curve. (I haven't thought too deeply into this, but that might be meaningful for assets that have some weird external costs involved in transferring them, or some sort of transition point between transfer methods.) I'd just reword it to say that the x values must always be greater than the previous and the y values must be equal or greater.
@adrianhopebailie @emschwartz @mDuo13 Updated to address your comments. I used That meant taking out the explanation of why we chose |
asn1/InterledgerProtocol.asn
Outdated
@@ -7,8 +7,7 @@ IMPORTS | |||
UInt64 | |||
FROM GenericTypes | |||
|
|||
Address, | |||
Amount | |||
Address | |||
FROM InterledgerTypes | |||
|
|||
MetadataEntry |
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.
MetadataEntry
should be removed
No description provided.