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

Partial Payments protections #196

Closed
mDuo13 opened this issue Mar 24, 2021 · 0 comments · Fixed by #215
Closed

Partial Payments protections #196

mDuo13 opened this issue Mar 24, 2021 · 0 comments · Fixed by #215
Labels
breaking Changes that would break existing users enhancement New feature or request

Comments

@mDuo13
Copy link
Collaborator

mDuo13 commented Mar 24, 2021

Messing up Partial Payments is one of the costliest, common mistakes people make when building on the XRP Ledger.

People look at the "Amount" field of a successful transaction and assume that's how much it delivered, when actually, it may have delivered a minuscule amount instead.

ripple-lib attempts to protect against this in a couple ways, which we should adapt or improve on:

  • getTransaction() and getTransactions() remove the field (specification.destination.amount in the ripple-lib specific format) from the parsed transaction response. You have to pass an option (includeRawTransaction) to get the original version with the potentially-misleading raw field.
  • The outcome of getTransaction() shows a balance_changes object that parses through the metadata to show how much currency (of varying types) was actually delivered.
  • It doesn't have any protections when calling the rippled APIs directly using .request(methodname, options).

One thing we could do fairly safely is to rename the field from Amount field of Payments to DeliverMax in some or all cases. The JSON format is not really "canonical" anyway, only the binary format, so you can call the fields whatever you want as long as you know what they correspond to.

See also: XRPLF/rippled#3484

@mDuo13 mDuo13 added this to the First pip release milestone Mar 24, 2021
@mDuo13 mDuo13 added the breaking Changes that would break existing users label Mar 24, 2021
@mDuo13 mDuo13 changed the title [FEATURE] Partial Payments protections Partial Payments protections Mar 24, 2021
@mDuo13 mDuo13 added the enhancement New feature or request label Mar 24, 2021
@ledhed2222 ledhed2222 removed this from the v1.0.0 milestone Mar 26, 2021
@ledhed2222 ledhed2222 linked a pull request Mar 30, 2021 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Changes that would break existing users enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants