-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Track escrow in recipient's owner directory (RIPD-1523): #2212
Conversation
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 good with some minor caveats.
src/ripple/app/main/Amendments.cpp
Outdated
@@ -57,7 +57,8 @@ supportedAmendments () | |||
{ "DC9CA96AEA1DCF83E527D1AFC916EFAF5D27388ECA4060A88817C1238CAEE0BF EnforceInvariants" }, | |||
{ "3012E8230864E95A58C60FD61430D7E1B4D3353195F2981DC12B0C7C0950FFAC FlowCross" }, | |||
{ "CC5ABAE4F3EC92E94A59B1908C2BE82D2228B6485C00AFF8F22DF930D89C194E SortedDirectories" }, | |||
{ "B4D44CC3111ADD964E846FC57760C8B50FFCD5A82C86A72756F6B058DDDF96AD fix1201" } | |||
{ "B4D44CC3111ADD964E846FC57760C8B50FFCD5A82C86A72756F6B058DDDF96AD fix1201" }, | |||
{ "6E3FF89E20D93A6C51FAE78409EB68B74DCEA0FA8AA50A2A364630241DC18976 fix1523" } |
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.
B9E739B8296B4A1BB29BE990B17D66E21B62A300A909F25AC55C22D6C72E1F9D
for fix1523
?
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.
Oops. Last minute rename!
src/test/app/Escrow_test.cpp
Outdated
{ | ||
testcase ("Metadata (with fix1523, to self)"); | ||
|
||
Env env(*this, with_features(featureEscrow)); |
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 be with_features(featureEscrow, fix1523)
to match the message on L710?
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.
Yes.
src/test/app/Escrow_test.cpp
Outdated
// Verify that Carol's owner directory tracks the escrow entry too. | ||
ripple::Dir cod (*env.current(), keylet::ownerDir(carol.id())); | ||
BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); | ||
BEAST_EXPECT(std::find(cod.begin(), cod.end(), escrow) != cod.end()); |
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.
Is it worth adding a test to confirm EscrowFinish
and EscrowCancel
properly delete the entries in both directories?
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.
👍
src/ripple/app/tx/impl/Escrow.cpp
Outdated
{ | ||
TER const ter = dirDelete(ctx_.view(), true, | ||
(*slep)[sfAltOwnerNode], keylet::ownerDir((*slep)[sfDestination]), | ||
k.key, false, false, ctx_.app.journal ("View")); |
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 owner deletion checks page==0
for the bSoft
argument (second to last) of dirDelete
. Is that important to mirror here?
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: that's legacy code (that should have never been there for things like escrow).
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 only have one suggestion beyond the comments that Brad already made...
src/ripple/protocol/SField.h
Outdated
@@ -387,6 +387,7 @@ extern SF_U64 const sfBaseFee; | |||
extern SF_U64 const sfExchangeRate; | |||
extern SF_U64 const sfLowNode; | |||
extern SF_U64 const sfHighNode; | |||
extern SF_U64 const sfAltOwnerNode; |
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.
Consider sfDestinationNode
, as suggested in the Checks proposal: https://ripplelabs.atlassian.net/wiki/spaces/RIPD/pages/111566093/Checks. I think sfDestinationNode
is descriptive of the intent for both Checks and Escrow. It would probably work well for Payment Channels as well.
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.
👍 done!
|
||
{ | ||
testcase ("Metadata & Ownership (without fix1523)"); | ||
Env env(*this, with_features(featureEscrow)); |
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'd lean toward all_features_except()
in this case and then just the default Env
(with all features) for the remaining tests, but I realize there is some refactoring by @scottschurr that might impact some of this too.
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 squinted at the features handling in these unit tests. I figured I'd make a tidying pass on this test after my other changes are merged. Which is not to say I disagree with @mellery451's suggestions. They are good ones...
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.
Just to be clear, are you suggesting that this be: Env env(*this, all_features_except(fix1523))
?
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.
@nbougalis yes, that's what I was thinking
Looks like one of the unit tests is failing. But the unit test output is a bit too quiet, so I can't tell which of the tests is failing... |
pretty sure that the failure is |
Codecov Report
@@ Coverage Diff @@
## develop #2212 +/- ##
===========================================
+ Coverage 70.05% 70.07% +0.01%
===========================================
Files 689 689
Lines 50724 50729 +5
===========================================
+ Hits 35533 35546 +13
+ Misses 15191 15183 -8
Continue to review full report at Codecov.
|
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 good to me with all the suggested changes. Tests out fine on macOS.
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.
Added tests look great.
Rebased and squashed. For inclusion into 0.80.0. |
Introduce "fix1523" which corrects a minor technical flaw with the original implementation of the escrow feature. When creating an escrow, the entry would only be tracked in the owner directory of the sender; as a result, an escrow recipient would not be able to detect incoming escrows without monitoring the ledger in real-time for transactions of interest or without the sender communicating this information out of band. With the fix in place, escrows where the recipient differs from the sender will be listed in the recipient's owner directory as well.
Merged as c7c1b3c |
Introduce "fix1523" which corrects a minor technical flaw with
the original implementation of the escrow feature.
When creating an escrow, the entry would only be tracked in the
owner directory of the sender; as a result, an escrow recipient
would not be able to detect incoming escrows without monitoring
the ledger in real-time for transactions of interest or without
the sender communicating this information out of band.
With the fix in place, escrows where the recipient differs from
the sender will be listed in the recipient's owner directory as
well.