0027 XLS-27d: (DEPRECATED) Token-Enabled Escrows and Payment Channels #72
Replies: 2 comments 10 replies
-
The quirk with this is that the XRPL uses finite-precision math for issued asset balances. For example, X+Y-X is not guaranteed to equal Y. So while this will almost perfectly work, it can't absolutely guarantee 100% of the locked amount will be available 100% of the time. At least, I don't see how it could. Someone could, for example, create an escrow for 10^16 of an asset and then an escrow for 1 of an asset. If they then terminate the escrow for 10^16 of the asset, the locked balance will return to zero even though 1 unit is still supposed to be locked. This will probably never matter in practice with real assets with non-malicious issuers. |
Beta Was this translation helpful? Give feedback.
-
@JoelKatz i think the criticism that there are possible dust exploits due to loss of precision in the floating point regime are valid but I also think they must logically extend to the whole DEX. My only consideration is that a malicious user should not be able to place the ledger into a state where an assertion fails due to some precision loss exploit. That is something to consider carefully in testing. |
Beta Was this translation helpful? Give feedback.
-
XLS-27d Token-Enabled Escrows and Payment Channels
Deprecated in favour of XLS-34d
Introduction
The XRPL supports several types of on-ledger negotiable Instruments, namely: Escows, Payment Channels and Checks. While each of these instruments is implemented as a first-class on-ledger object, only the Check object supports the use of Trust Line balances. Payment Channels and Escrows support only the native asset XRP. This limitation is a barrier to wider-spread use of these Instruments for reasons including:
This XLS proposes to introduce an Amendment to the XRPL protocol: featurePaychanAndEscrowForTokens.
The amendment has the following goals:
Trust Lines
Trust Line balances are issued by users of the XRPL (called Issuers). They exist on-ledger as RippleState objects.
Each Trust Line (RippleState object) consists of:
A Trust Line currency is uniquely identified by the the combination of its issuer and currency code.
Locked Balances
To facilitate locking Trust Line balances into on-ledger Instruments, an additional piece of information is added to each relevant Trust Line:
If all or some of the Trust Line balance is locked by a Payment Channel or an Escrow then this amount is accounted for in the Locked Balance field. The Trust Line Balance less the Locked Balance is the user's spendable balance for that asset. This may be zero if the whole balance is locked.
The rules for the Locked Balance field are as follows
For each Instrument (e.g. Escrow, PayChan) a user holds that locks up some tokens from a Trust Line:
Settlement
An Instrument can only be created over a Trust Line balance if both parties (source and destination) are:
The destination may not have a Trust Line yet. This is not a bar to creating the Instrument provided that a hypothetical Trust Line created at the same time the Instrument is created, from the destination account to the Issuer, for the relevant currency, would meet the above requirements.
Settling an Instrument (e.g. EscrowFinish, PaymentChannelClaim) carries the same semantics as crossing an offer: If no Trust Line exists on the destination side, then a Trust Line with zero limit is created and the tokens (balance) are placed into that line. However creation of a Trust Line requires the transaction to be signed by the receiving account (because it creates an on-ledger object and increases the Owner Count and thus the XRP reserve locked by the destination account.)
Frozen Lines
It is possible an Issuer causes an Instrument that uses some of their issued tokens to become frozen. They can do this by simply freezing their side of their Trust Line with either of the parties to the Instrument. This prevents the Instrument from being resolved or cancelled until the freeze is lifted.
Escrows and Payment Channels in this or any state are a bar to account deletion. Trust Lines with LockedBalance (from any source) are also a bar to account deletion.
Beta Was this translation helpful? Give feedback.
All reactions