-
Notifications
You must be signed in to change notification settings - Fork 1.5k
VaultWithdraw destination account bugfix #5572
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
Conversation
- Unfortunately, to not change behavior, a new "Legacy" authorization type was created. It acts like "StrongAuth" for MPTs and "WeakAuth" for IOUs.
932dd8b
to
dec0bf7
Compare
250cea2
to
14cb2e1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #5572 +/- ##
=========================================
- Coverage 78.8% 78.8% -0.0%
=========================================
Files 814 814
Lines 71205 71222 +17
Branches 8330 8362 +32
=========================================
- Hits 56111 56089 -22
- Misses 15094 15133 +39
🚀 New features to boost your workflow:
|
cb4a73c
to
88d712e
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.
Tiny comment change
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.
LGTM
Co-authored-by: Ed Hennis <ed@ripple.com>
auto const trustLine = | ||
view.read(keylet::line(account, issue.account, issue.currency)); | ||
// If account has no line, and this is a strong check, fail | ||
if (!trustLine && authType == AuthType::StrongAuth) |
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.
Shouldn't this be gated by an amendment?
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.
No, because before this change there was no way to pass AuthType::StrongAuth
to this function (i.e. the old behaviour was always as-if AuthType::WeakAuth
was used). So the new behaviour will only be enabled in the code changed in this PR, where we change the parameters passed to requireAuth
.
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.
LGTM 👍
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 a super-thorough review, but since there are two others, I figure that's ok. I confirmed that my earlier requested changes have been addressed, and gave the rest of the changes a quick read-through.
thanks @ximinez ! |
@@ -315,14 +315,14 @@ escrowCreatePreclaimHelper<MPTIssue>( | |||
// authorized | |||
auto const& mptIssue = amount.get<MPTIssue>(); | |||
if (auto const ter = | |||
requireAuth(ctx.view, mptIssue, account, MPTAuthType::WeakAuth); | |||
requireAuth(ctx.view, mptIssue, account, AuthType::WeakAuth); |
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.
Require proof of work to withdrawl
ter != tesSUCCESS) | ||
return ter; | ||
|
||
// If the issuer has requireAuth set, check if the destination is | ||
// authorized | ||
if (auto const ter = | ||
requireAuth(ctx.view, mptIssue, dest, MPTAuthType::WeakAuth); | ||
requireAuth(ctx.view, mptIssue, dest, AuthType::WeakAuth); |
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.
no auth
High Level Overview of Change
Remove automatic creation of trust line to
Destination
account inVaultWithdraw
.Context of Change
#5224 added (among other things) a
VaultWithdraw
transaction which allows setting the recipient of the withdrawn funds in theDestination
transaction field. This technically turns this transaction into a payment, and in some respect the implementation does follow payment rules e.g. enforcement oflsfRequireDestTag
orlsfDepositAuth
or that MPT transfer has destinationMPToken
. However for IOU, it missed verification that the destination account has trust line to the asset issuer. Since the default behaviour ofaccountSendIOU
is to create this trust line (if missing), this is whatVaultWithdraw
currently does. This is incorrect, since theDestination
might not be interested in holding the asset in question; this basically enables spammy transfers.Thanks to @ximinez who found the issue and implemented the fix.
Type of Change
.gitignore
, formatting, dropping support for older tooling)