Skip to content
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

Consolidate Infura and custom network clients #1279

Open
Gudahtt opened this issue Apr 27, 2023 · 1 comment
Open

Consolidate Infura and custom network clients #1279

Gudahtt opened this issue Apr 27, 2023 · 1 comment
Labels

Comments

@Gudahtt
Copy link
Member

Gudahtt commented Apr 27, 2023

Today we have two types of networks in the network controller: built-in Infura networks, and networks that we keep track of with the networkConfigurations state ("RPC" type networks). We also have two separate kinds of network clients with different middleware for each type of network and different network configuration objects. This leads to much unnecessary complexity.

We should only ever have to use one function to create a network client, and it should take the same shape for the network configuration, whether the network is an Infura network or custom network. This would greatly simplify the network controller API, and it would allow easier customization of which networks are built-in.

To achieve this, it is worth it to review the list of features that Infura network clients have over custom network clients:

  • Custom retry error handling
    The Infura networks use custom middleware that looks for Infura-specific errors, enabling more effective retry logic for Infura.
  • Country blocked error handling
    The Infura networks have custom support for an error that indicates geoblocking. This isn't supported for other networks.
  • Secrets in RPC URLs
    The Infura RPC URL we use has a secret embedded in the URL path. Our network configuration offers no way to obscure secrets in URL paths.
  • Custom headers
    We set custom fetch headers on requests to the built-in Infura networks.

Ideally, if we can enable these features for all networks, not just Infura ones, that would be ideal. However, if we need a way to customize a network client, then we should add new options to the network client configuration object which would allow for turning on select features.

@Gudahtt Gudahtt added the enhancement New feature or request label Apr 27, 2023
@Gudahtt Gudahtt mentioned this issue Apr 27, 2023
3 tasks
@mcmire mcmire changed the title Use network configuration for built-in Infura networks Consolidate Infura and custom network clients Apr 18, 2024
@desi
Copy link
Contributor

desi commented Apr 22, 2024

The changes here were off the top of head. This need more investigation into what might actually be needed. Additional refinement should happen.

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

No branches or pull requests

3 participants