fix(rpc-service): Consider all Infura HTTP errors as service failures except 400 and 429#9123
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
The changes look good to me. I think they just warrant adding some unit tests to cover the new cases.
While testing I added some tests locally and now I opened this PR to make sure we don’t break anything: #9169
Let me know what you think.
Member
Author
Those LGTM! |
…on (#9169) Follow up to #9123 to add the missing test coverage and fix a stale comment. Targets that PR's branch so it merges in before #9123 goes to main. ## What this adds `packages/controller-utils` (`create-service-policy.test.ts`): - Custom `isServiceFailure` opens the circuit when the predicate treats the error as a failure, and never opens it when it does not. - The predicate is called with the raw error thrown by the service. - The default predicate still applies when the option is omitted (breaks on `httpStatus >= 500`, not on `< 500`). `packages/network-controller` (`rpc-service.test.ts`): - On an Infura endpoint, 400 and 429 do not break the circuit, while 401 and 500 do. - A non Infura endpoint with the same config does not break on 401, which proves the Infura predicate is what changes the behavior.
cryptodev-2s
approved these changes
Jun 17, 2026
salimtb
approved these changes
Jun 17, 2026
This file contains hidden or 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
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.
Explanation
Consider all HTTP errors thrown by
RpcServicewhen using Infura as service policy failures except if the HTTP status code is400or429. Previously we would only consider5xxHTTP status codes as failures that could trip the circuit.References
https://consensyssoftware.atlassian.net/browse/WPC-1111
Checklist