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
[VDG] Change PrivacyWarnings to IAsyncEnumerable #11163
[VDG] Change PrivacyWarnings to IAsyncEnumerable #11163
Conversation
ichthus1604
commented
Jul 31, 2023
•
edited
edited
- Fixes [VDG] Change avoidance calculation blocks all the transaction warnings #11031
- Marked as draft because there is a hard to debug race deadlock that I haven't been able to fix yet, which stops the change avoidance suggestions from yielding, thus the flyout stays busy forever.
@soosr I figured out the problem was due to the early disposal of the Marked as ready for review. |
…rform heavy actions
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
Show resolved
Hide resolved
WalletWasabi.Fluent/Models/Transactions/PrivacySuggestionsResult.cs
Outdated
Show resolved
Hide resolved
{ | ||
public List<PrivacyWarning> Warnings { get; } = new(); | ||
public List<PrivacySuggestion> Suggestions { get; } = new(); | ||
private List<IAsyncEnumerable<PrivacyItem>> _combinedResults = new(); |
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.
nit, but more like a question... Can we somehow prioritize the items here? Because by the testing it seems to me during processing if the first item is a ChangeAvoidance item (and it takes seconds to finish), every other suggestion is waiting to be shown, despite their computation being already done.
We know that always the computation of the ChangeAvoidance items will take the most so put them at the end of the processing?
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.
@soosr Can you share the steps to reproduce this? Adding a 5 second delay in VerifyChangeAsync() line 218, I get all the other suggestions properly shown in the flyout and then the change-related ones appear in the end.
The IAsyncEnumerable
s are added to a regular List which is then iterated over, so we should get the results in the same order we insert them:
result
.Combine(VerifyLabels(info, transactionResult))
.Combine(VerifyPrivacyLevel(info, transactionResult))
.Combine(VerifyConsolidation(transactionResult))
.Combine(VerifyUnconfirmedInputs(transactionResult))
.Combine(VerifyCoinjoiningInputs(transactionResult))
.Combine(VerifyChangeAsync(info, transactionResult, _linkedCancellationTokenSource));
Unless I'm missing something?
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 added a 5 seconds delay before this line
transaction = _wallet.BuildChangelessTransaction( |
Just to simulate if the BnB algorithm runs longer (it can run up to 15 seconds).
After this, I did my testing by repeatedly creating a transaction where I know only the Label Management
and a Less
and a More
change avoidance suggestion is possible.
I noticed that sometimes the Label Management
option appears later. Taking a look at the logs I could see that when this scenario happened it always appeared after a change avoidance calculation was done.
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.
tACK
Merging since #11163 (comment) is not a blocker. @ichthus1604 think about it, you might have a good idea. |