From 253a94f9216306a592299313508803cbeb8a11eb Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 3 Nov 2023 15:44:27 -0500 Subject: [PATCH] fix: wrong network when accessing upstream provider [APE-1503] (#1724) --- src/ape/api/networks.py | 2 +- tests/functional/test_network_api.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ape/api/networks.py b/src/ape/api/networks.py index 3e61153246..b372de6cde 100644 --- a/src/ape/api/networks.py +++ b/src/ape/api/networks.py @@ -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.") diff --git a/tests/functional/test_network_api.py b/tests/functional/test_network_api.py index 4eb487f744..fbe08a23bc 100644 --- a/tests/functional/test_network_api.py +++ b/tests/functional/test_network_api.py @@ -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