-
Notifications
You must be signed in to change notification settings - Fork 40
Add fee estimator and enable fees #1083
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
base: graphite-base/1083
Are you sure you want to change the base?
Add fee estimator and enable fees #1083
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Enable fees by requiring a rates fetcher during replication server startup and calculating message publish fees via
|
| return nil, errors.New("http listener not provided") | ||
| } | ||
|
|
||
| if cfg.RatesFetcher == nil { |
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 server fails to initialize without a RatesFetcher even when neither replication nor sync features are enabled, blocking use cases that don't require rates fetching.
This happens because cfg.RatesFetcher is checked unconditionally in NewReplicationServer, but it's only actually needed when cfg.Options.Replication.Enable or cfg.Options.Sync.Enable is true.
Consider only enforcing the RatesFetcher non-nil check when either replication or sync is enabled, so that servers without those features can initialize successfully.
- if cfg.RatesFetcher == nil {
- return nil, errors.New("rates fetcher not provided")
- }
+ if (cfg.Options.Replication.Enable || cfg.Options.Sync.Enable) && cfg.RatesFetcher == nil {
+ return nil, errors.New("rates fetcher not provided")
+ }🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
59b2f01 to
cb08bc4
Compare
cdc1a5c to
9a8d5b7
Compare
cb08bc4 to
5f77193
Compare
9a8d5b7 to
92fadc0
Compare
5f77193 to
f7d0640
Compare
92fadc0 to
a1a2b83
Compare
f7d0640 to
c69cb89
Compare
a1a2b83 to
4d288d4
Compare
c69cb89 to
639eb4c
Compare
84f1b17 to
423eadb
Compare
639eb4c to
4132c61
Compare
423eadb to
46e3ef3
Compare
4132c61 to
19073e4
Compare
46e3ef3 to
487940b
Compare
19073e4 to
01a5e7c
Compare
487940b to
a0fe85b
Compare
7a5f4e9 to
e17cba4
Compare
a0fe85b to
4492e4c
Compare
e17cba4 to
aea804e
Compare
4492e4c to
260f23b
Compare
TL;DR
Added a fee estimation system to improve fee calculation for message publishing.
What changed?
FeeEstimatorthat wraps the existingFeeCalculatorto provide fee estimates based on recent congestion calculationsIFeeEstimatorinterface that extendsIFeeCalculatorwith anEstimateFeesmethodpublishWorkerinto a utility functionCalculateStagedOriginatorEnvelopeFeesIFeeCalculatorinterface to mockery configurationHow to test?
Why make this change?
This change improves the fee calculation system by:
The fee estimator provides a more efficient way to calculate fees by avoiding redundant congestion calculations, which improves performance for high-volume message publishing.