Skip to content

Commit

Permalink
fix: wrong network when accessing upstream provider [APE-1503] (#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Nov 3, 2023
1 parent 848bad2 commit 253a94f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ape/api/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ def upstream_provider(self) -> "UpstreamProvider":

config_choice = self._network_config.get("upstream_provider")
if provider_name := config_choice or self.upstream_network.default_provider:
return self.get_provider(provider_name)
return self.upstream_network.get_provider(provider_name)

raise NetworkError(f"Upstream network '{self.upstream_network}' has no providers.")

Expand Down
2 changes: 2 additions & 0 deletions tests/functional/test_network_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ def test_forked_networks(ethereum):
mainnet_fork = ethereum.mainnet_fork
assert mainnet_fork.upstream_network.name == "mainnet"
assert mainnet_fork.upstream_chain_id == 1
# Just make sure it doesn't fail when trying to access.
assert mainnet_fork.upstream_provider

0 comments on commit 253a94f

Please sign in to comment.