-
Notifications
You must be signed in to change notification settings - Fork 492
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
Upgrading ThirdPartyFeeProvider to support list of fee providers #13016
base: master
Are you sure you want to change the base?
Conversation
We are planning to move the responsibility of fetching the mining fee rates from the server to the client. The ultimate goal is to make Wasabi to work without a central server, or at least that's the direction I think we have to go. Each user should be able to chose which fee provider to trust on, We cannot maintain tens of fee providers and, even when they would all look exactly the same, because after all they all have to make a http request to get a json containing a list of So, the idea is to simplify that task. Imagine something like a class WebFeeProvider : PeriodicRunner
{
private IFeeProviderHandler _feeProviderHandler;
public FeeRateCollection FeeRates { get; private set; }
public async Task ActionAsync()
{
var json = _httpClient.SendAsync(HttpMethod.Get, _feeProviderHandler.ApiUrl)
FeeRates = _feeProviderHandler.Parse(json);
}
}
interface IFeeProviderHandler {
string ApiUrl { get; }
FeeRateCollection Parse(JObject /*or string*/ apiResponse);
} Then, if you implement this, your |
This is on the client side. |
Created #13022 as a feature request. |
Upgrading ThirdPartyFeeProvider too support list of fee providers. Co-Authored-By: Kimi <58662979+kiminuo@users.noreply.github.com>
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.
First, it's nice that you split this PR with the integration of mempool.space, that we can easily do later.
The code is a bit hard to understand but the concept is OK. Code mostly LGTM. I just have 2 small questions that I wrote as comments.
You mentioned in the meeting that the codebase in general lacks useful comments, maybe adding some to this kind of PR is a good way to not worsen the problem. FYI most uncommented features were coded early, and most new features are properly commented.
I made turbolay@6c4a066. You can choose whether to apply it or not, it applies some suggestions from Rider and fixes few warnings.
As @kiminuo mentioned, it would be great to have Unit Tests as the concept is not trivial (eg a test that shows that priority is respected, another one to ensure that priority goes back to first provider when it's not OnError
anymore and that other providers are paused)
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Show resolved
Hide resolved
You have a point there. I will create a commit that has the comments you already asked.
I have mixed feelings here.
Began to write a unit test (and caught a bug, khm). |
Minor changes
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 pushed 2 commits on this PR, harmless simply style and a small addition to the test
However, upon testing there are 2 things not really great with the implementation:
- It's too long to wait for the backup when a provider is
OnError
- Excluding for the
WasabiSynchronizer
(which long term won't be a fee provider), it's useless to wait 1 minute when beingOnError
, because the period of the otherprovider
(currently only Blockstream) is higher than 1 minute
I can suggest 2 things:
- Reduce the
period
of the providers, but return immediately if last result was less than 3 minutes ago turbolay@257d242 -> This change might be enough by itself. - Expose
TriggerRound
inIThirdPartyFeeProvider
and call it whenIsPaused
goes from false to true inSetPauseStates
turbolay@bea838a
As mentioned, 2nd suggestion might be overkill, as first one would already improve (and we would need to wait max 10s). So you can choose whether to implement or not, modify my suggestions etc... Your call.
With one modification of the kind, this PR can be merged.
I would go with the second as its cleaner. |
I went with the second approach, but with separate method name for cleaner interface (TriggerOutOfOrderUpdate) + unit test. |
WalletWasabi/Blockchain/Analysis/FeesEstimation/IThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
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.
We talked with Csiki on Slack. The idea here is to make ThirdPartyFeeProvider
the one and only API for providing fees. There are multiple approaches IMO this is reasonable first step, because it is not breaking anything and using the current structure but opens the space for increments.
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
WalletWasabi/Blockchain/Analysis/FeesEstimation/ThirdPartyFeeProvider.cs
Outdated
Show resolved
Hide resolved
Why did you override my commits? |
You told me, I can choose. |
No, I pushed commits on your PR to fix style that you overrode with a forced push, mentioned here:
Anyway, lost too much time on this, won't happen again. |
Isn't this PR now obsolete with #13035? |
"No, I pushed commits on your PR to fix style that you overrode with a forced push, mentioned here:" |
Different branch. |
Argh. My fault. Terribly sorry about that. :( |
That branch is the future of Wasabi Wallet that's why others are working on it. |
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 am not sure what is the future of this, meanwhile the other PR was borned - anyway I tested it and reviewed the code.
tACK
See why I said I would merge #13031 after |
I don't have high hopes that this change will be merged. Still, I fixed the conflict. |
Upgrading ThirdPartyFeeProvider to support list of fee providers.
Later HybridFeeProvider can be removed since it's a sort of duplicate.