Skip to content

Add handling of Infura "blocked" status #1264

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

Merged
merged 1 commit into from
Apr 28, 2023
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Apr 25, 2023

Description

The network controller has been updated to detect when connecting to an Infura network fails due to the user being blocked. A new status has been added to reflect this state, and two events have been added (one for when a user is blocked, and one for when they are unblocked).

This status and these events are used by the extension to better explain why the network is not working in this scenario.

Changes

  • BREAKING: The network status will now be "blocked" rather than "unavailable" when the user is blocked by Infura
  • ADDED: The events "infuraIsBlocked" and "infuraIsUnblocked" have been added

References

Fixes #1200

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation for new or updated code as appropriate (note: this will usually be JSDoc)
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@Gudahtt Gudahtt force-pushed the add-infura-blocked-detection branch from 5b1308e to dc14f06 Compare April 25, 2023 20:24
@Gudahtt Gudahtt changed the base branch from main to refactor-lookup-network-tests April 25, 2023 20:24
@Gudahtt

This comment was marked as resolved.

@Gudahtt Gudahtt mentioned this pull request Apr 25, 2023
3 tasks
@Gudahtt Gudahtt force-pushed the refactor-lookup-network-tests branch from 2875383 to af9cb2c Compare April 27, 2023 17:53
Base automatically changed from refactor-lookup-network-tests to main April 27, 2023 18:01
@Gudahtt Gudahtt force-pushed the add-infura-blocked-detection branch from dc14f06 to cbfd2d0 Compare April 27, 2023 18:03
@Gudahtt Gudahtt marked this pull request as ready for review April 27, 2023 18:04
@Gudahtt Gudahtt requested a review from a team as a code owner April 27, 2023 18:04
The network controller has been updated to detect when connecting to an
Infura network fails due to the user being blocked. A new status has
been added to reflect this state, and two events have been added (one
for when a user is blocked, and one for when they are unblocked).

This status and these events are used by the extension to better
explain why the network is not working in this scenario.

Fixes #1200
@Gudahtt Gudahtt force-pushed the add-infura-blocked-detection branch from cbfd2d0 to d83f829 Compare April 27, 2023 18:08
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. One thing I'm noticing is that the unit tests here don't seem to be as exhaustive as the ones in extension. For instance, in the tests for initializeProvider we not only test that the provider is set but also that infuraIsBlocked or infuraIsUnblocked is emitted and that the network status is updated, etc.. So there are more tests we could bring over in this PR as it relates to Infura blocked/unblocked. That said, we could also cover that sort of thing in #1197. The tests you've added seem sufficient to prove that the new code is working as intended.

@Gudahtt
Copy link
Member Author

Gudahtt commented Apr 28, 2023

Handling that as part of #1197 makes sense to me. I considered doing it here, but I wasn't sure if we wanted the final test suite to be organized that way. The way it's setup now (both in here and the extension) is... inconsistent and repetitive. We might want to factor our "lookupNetwork" behavioral tests into a function to more easily repeat them, or something like that.

@Gudahtt Gudahtt merged commit c8f508c into main Apr 28, 2023
@Gudahtt Gudahtt deleted the add-infura-blocked-detection branch April 28, 2023 17:30
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The network controller has been updated to detect when connecting to an
Infura network fails due to the user being blocked. A new status has
been added to reflect this state, and two events have been added (one
for when a user is blocked, and one for when they are unblocked).

This status and these events are used by the extension to better
explain why the network is not working in this scenario.

Fixes #1200
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The network controller has been updated to detect when connecting to an
Infura network fails due to the user being blocked. A new status has
been added to reflect this state, and two events have been added (one
for when a user is blocked, and one for when they are unblocked).

This status and these events are used by the extension to better
explain why the network is not working in this scenario.

Fixes #1200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NetworkController API normalization: Add support for Infura blocked network status
2 participants