-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: Choose a consensus strategy #286
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9bfa13e
to
814bf8b
Compare
THLO
reviewed
Sep 23, 2024
THLO
reviewed
Sep 23, 2024
THLO
reviewed
Sep 23, 2024
THLO
approved these changes
Sep 23, 2024
Co-authored-by: Thomas Locher <[email protected]>
rvanasa
approved these changes
Sep 23, 2024
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.
Thanks for taking this on! The refactoring changes look great. LGTM modulo the ongoing conversation about what to name num_providers
and min_num_ok
.
gregorydemay
added a commit
that referenced
this pull request
Sep 24, 2024
Follow-up on #286 to implement the threshold strategy to aggregate responses from multiple providers: - Introduce a top-level `MultiCallResults::reduce` method which takes as parameter a `ConsensusStrategy` to aggregate the various responses. All existing methods, including `eth_fee_history`, were refactor to use the new `reduce` method. - In case of `ConsensusStrategy::Threshold`, the reduction strategy simply consists of returning the most frequent (non-error) response if it appeared at least the specified threshold number of times. - Refactor `MultiCallResults` to stored ok results and errors separately.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a new parameter in
RpcConfig
to let the caller choose between different consensus strategies to aggregate answers from multiple providers. Two strategies are defined, with the possibility of adding more in the future:Equality
: this is the default and matches the current behaviour, where all responses are expected to be non-error cases and all responses are expected to be equal.Threshold
: new strategy introduced by this PR, allowing to relax the aforementioned equality strategy to only a subset of the responses. Choosing this strategy may influence the chosen providers to match the specified threshold parameters. The implementation of responses aggregation in this case is done in a separate PR (feat: implement threshold strategy #287).