diff --git a/docs/userguides/config.md b/docs/userguides/config.md index 0777ece80e..f922246c0f 100644 --- a/docs/userguides/config.md +++ b/docs/userguides/config.md @@ -72,7 +72,7 @@ deployments: mainnet: - contract_type: MyContract address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 - goerli: + sepolia: - contract_type: MyContract address: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 ``` diff --git a/docs/userguides/networks.md b/docs/userguides/networks.md index e0889d5ac7..a9fc355060 100644 --- a/docs/userguides/networks.md +++ b/docs/userguides/networks.md @@ -1,6 +1,6 @@ # Networks -When interacting with a blockchain, you will have to select an ecosystem (e.g. Ethereum, Arbitrum, or Fantom), a network (e.g. Mainnet or Goerli) and a provider (e.g. Eth-Tester, Geth, or Alchemy). +When interacting with a blockchain, you will have to select an ecosystem (e.g. Ethereum, Arbitrum, or Fantom), a network (e.g. Mainnet or Sepolia) and a provider (e.g. Eth-Tester, Geth, or Alchemy). Networks are part of ecosystems and typically defined in plugins. For example, the `ape-ethereum` plugin comes with Ape and can be used for handling EVM-like behavior. diff --git a/docs/userguides/scripts.md b/docs/userguides/scripts.md index 8e14e41dc2..17bff861bb 100644 --- a/docs/userguides/scripts.md +++ b/docs/userguides/scripts.md @@ -77,7 +77,7 @@ from ape.cli import ape_cli_context def cli(cli_ctx): # There is no connection yet at this point. testnets = { - "ethereum": ["sepolia", "goerli"], + "ethereum": ["sepolia"], "polygon": ["mumbai"] } nm = cli_ctx.network_manager diff --git a/docs/userguides/transactions.md b/docs/userguides/transactions.md index 5f15e94579..49f30f52fd 100644 --- a/docs/userguides/transactions.md +++ b/docs/userguides/transactions.md @@ -40,7 +40,7 @@ assert receipt.sender == dev Deploying from [ape console](./console.html) allows you to interact with a contract in real time. You can also use the `--network` flag to connect a live network. ```bash -ape console --network ethereum:goerli:alchemy +ape console --network ethereum:sepolia:alchemy ``` This will launch an IPython shell: diff --git a/src/ape_ethereum/ecosystem.py b/src/ape_ethereum/ecosystem.py index 5a75afe710..eafc815507 100644 --- a/src/ape_ethereum/ecosystem.py +++ b/src/ape_ethereum/ecosystem.py @@ -80,7 +80,6 @@ NETWORKS = { # chain_id, network_id "mainnet": (1, 1), - "goerli": (5, 5), "sepolia": (11155111, 11155111), } BLUEPRINT_HEADER = HexBytes("0xfe71") @@ -311,7 +310,6 @@ def _get_custom_network(self, name: str) -> NetworkConfig: class EthereumConfig(BaseEthereumConfig): mainnet: NetworkConfig = create_network_config(block_time=13) - goerli: NetworkConfig = create_network_config(block_time=15) sepolia: NetworkConfig = create_network_config(block_time=15) diff --git a/src/ape_geth/provider.py b/src/ape_geth/provider.py index 58e06208b5..2114aea14b 100644 --- a/src/ape_geth/provider.py +++ b/src/ape_geth/provider.py @@ -198,7 +198,6 @@ def wait(self, *args, **kwargs): class GethNetworkConfig(PluginConfig): # Make sure you are running the right networks when you try for these mainnet: Dict = {"uri": get_random_rpc("ethereum", "mainnet")} - goerli: Dict = {"uri": get_random_rpc("ethereum", "goerli")} sepolia: Dict = {"uri": get_random_rpc("ethereum", "sepolia")} # Make sure to run via `geth --dev` (or similar) local: Dict = {**DEFAULT_SETTINGS.copy(), "chain_id": DEFAULT_TEST_CHAIN_ID} diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index be489daca4..8a8f3d8918 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -515,7 +515,7 @@ def use_debug(logger): @pytest.fixture def dummy_live_network(chain): original_network = chain.provider.network.name - chain.provider.network.name = "goerli" + chain.provider.network.name = "sepolia" yield chain.provider.network chain.provider.network.name = original_network @@ -742,7 +742,8 @@ def mock_fork_provider(mocker, ethereum): A fake provider representing something like ape-foundry that can fork networks (only uses sepolia-fork). """ - actual = ethereum.sepolia_fork.__dict__.pop("providers", {}) + initial_providers = ethereum.sepolia_fork.__dict__.pop("providers", {}) + initial_default = ethereum.sepolia_fork._default_provider mock_provider = mocker.MagicMock() mock_provider.name = "mock" mock_provider.network = ethereum.sepolia_fork @@ -752,12 +753,15 @@ def fake_partial(*args, **kwargs): mock_provider.partial_call = (args, kwargs) return mock_provider + ethereum.sepolia_fork._default_provider = "mock" ethereum.sepolia_fork.__dict__["providers"] = {"mock": fake_partial} yield mock_provider - if actual: - ethereum.sepolia_fork.__dict__["providers"] = actual + if initial_providers: + ethereum.sepolia_fork.__dict__["providers"] = initial_providers + if initial_default: + ethereum.sepolia_fork._default_provider = initial_default @pytest.fixture diff --git a/tests/functional/geth/test_provider.py b/tests/functional/geth/test_provider.py index 42a0895818..16e07b1b2d 100644 --- a/tests/functional/geth/test_provider.py +++ b/tests/functional/geth/test_provider.py @@ -86,8 +86,8 @@ def test_repr_on_local_network_and_disconnected(networks): @geth_process_test def test_repr_on_live_network_and_disconnected(networks): - geth = networks.get_provider_from_choice("ethereum:goerli:geth") - assert repr(geth) == "" + geth = networks.get_provider_from_choice("ethereum:sepolia:geth") + assert repr(geth) == "" @geth_process_test @@ -106,8 +106,8 @@ def test_chain_id_when_connected(geth_provider): @geth_process_test def test_chain_id_live_network_not_connected(networks): - geth = networks.get_provider_from_choice("ethereum:goerli:geth") - assert geth.chain_id == 5 + geth = networks.get_provider_from_choice("ethereum:sepolia:geth") + assert geth.chain_id == 11155111 @geth_process_test @@ -132,12 +132,12 @@ def test_connect_wrong_chain_id(ethereum, geth_provider, web3_factory): start_network = geth_provider.network expected_error_message = ( f"Provider connected to chain ID '{geth_provider._web3.eth.chain_id}', " - "which does not match network chain ID '5'. " - "Are you connected to 'goerli'?" + "which does not match network chain ID '11155111'. " + "Are you connected to 'sepolia'?" ) try: - geth_provider.network = ethereum.get_network("goerli") + geth_provider.network = ethereum.get_network("sepolia") # Ensure when reconnecting, it does not use HTTP web3_factory.return_value = geth_provider._web3 @@ -151,15 +151,15 @@ def test_connect_wrong_chain_id(ethereum, geth_provider, web3_factory): def test_connect_to_chain_that_started_poa(mock_web3, web3_factory, ethereum): """ Ensure that when connecting to a chain that - started out as PoA, such as Goerli, we include + started out as PoA, such as Sepolia, we include the right middleware. Note: even if the chain is no longer PoA, we still need the middleware to fetch blocks during the PoA portion of the chain. """ mock_web3.eth.get_block.side_effect = ExtraDataLengthError - mock_web3.eth.chain_id = ethereum.goerli.chain_id + mock_web3.eth.chain_id = ethereum.sepolia.chain_id web3_factory.return_value = mock_web3 - provider = ethereum.goerli.get_provider("geth") + provider = ethereum.sepolia.get_provider("geth") provider.provider_settings = {"uri": "http://node.example.com"} # fake provider.connect() diff --git a/tests/functional/test_config.py b/tests/functional/test_config.py index ce25c912c3..854a61051b 100644 --- a/tests/functional/test_config.py +++ b/tests/functional/test_config.py @@ -95,26 +95,26 @@ def _create_deployments( def test_ethereum_network_configs(config, temp_config): - eth_config = {"ethereum": {"goerli": {"default_provider": "test"}}} + eth_config = {"ethereum": {"sepolia": {"default_provider": "test"}}} with temp_config(eth_config): actual = config.get_config("ethereum") - assert actual.goerli.default_provider == "test" + assert actual.sepolia.default_provider == "test" # Ensure that non-updated fields remain unaffected - assert actual.goerli.block_time == 15 + assert actual.sepolia.block_time == 15 def test_network_gas_limit_default(config): eth_config = config.get_config("ethereum") - assert eth_config.goerli.gas_limit == "auto" + assert eth_config.sepolia.gas_limit == "auto" assert eth_config.local.gas_limit == "max" -def _goerli_with_gas_limit(gas_limit: GasLimit) -> dict: +def _sepolia_with_gas_limit(gas_limit: GasLimit) -> dict: return { "ethereum": { - "goerli": { + "sepolia": { "default_provider": "test", "gas_limit": gas_limit, } @@ -124,12 +124,12 @@ def _goerli_with_gas_limit(gas_limit: GasLimit) -> dict: @pytest.mark.parametrize("gas_limit", ("auto", "max")) def test_network_gas_limit_string_config(gas_limit, config, temp_config): - eth_config = _goerli_with_gas_limit(gas_limit) + eth_config = _sepolia_with_gas_limit(gas_limit) with temp_config(eth_config): actual = config.get_config("ethereum") - assert actual.goerli.gas_limit == gas_limit + assert actual.sepolia.gas_limit == gas_limit # Local configuration is unaffected assert actual.local.gas_limit == "max" @@ -137,12 +137,12 @@ def test_network_gas_limit_string_config(gas_limit, config, temp_config): @pytest.mark.parametrize("gas_limit", (1234, "1234", 0x4D2, "0x4D2")) def test_network_gas_limit_numeric_config(gas_limit, config, temp_config): - eth_config = _goerli_with_gas_limit(gas_limit) + eth_config = _sepolia_with_gas_limit(gas_limit) with temp_config(eth_config): actual = config.get_config("ethereum") - assert actual.goerli.gas_limit == 1234 + assert actual.sepolia.gas_limit == 1234 # Local configuration is unaffected assert actual.local.gas_limit == "max" @@ -153,7 +153,7 @@ def test_network_gas_limit_invalid_numeric_string(config, temp_config): Test that using hex strings for a network's gas_limit config must be prefixed with '0x' """ - eth_config = _goerli_with_gas_limit("4D2") + eth_config = _sepolia_with_gas_limit("4D2") with pytest.raises(ValueError, match="Gas limit hex str must include '0x' prefix."): with temp_config(eth_config): pass diff --git a/tests/functional/test_ecosystem.py b/tests/functional/test_ecosystem.py index 1ddb193d05..72aed0c220 100644 --- a/tests/functional/test_ecosystem.py +++ b/tests/functional/test_ecosystem.py @@ -660,7 +660,7 @@ def test_gas_limit_local_networks(ethereum, network_name): def test_gas_limit_live_networks(ethereum): - network = ethereum.get_network("goerli") + network = ethereum.get_network("sepolia") assert network.gas_limit == "auto" @@ -865,7 +865,7 @@ def test_encode_transaction(tx_type, ethereum, vyper_contract_instance, owner, e assert actual.gas_limit == eth_tester_provider.max_gas -def test_set_default_network_not_exists(temp_config, ethereum): +def test_set_default_network_not_exists(ethereum): bad_network = "NOT_EXISTS" expected = f"No network in 'ethereum' named '{bad_network}'. Options:.*" with pytest.raises(NetworkNotFoundError, match=expected): @@ -874,7 +874,7 @@ def test_set_default_network_not_exists(temp_config, ethereum): def test_networks(ethereum): actual = ethereum.networks - for net in ("goerli", "sepolia", "mainnet", LOCAL_NETWORK_NAME): + for net in ("sepolia", "mainnet", LOCAL_NETWORK_NAME): assert net in actual assert isinstance(actual[net], NetworkAPI) @@ -884,7 +884,6 @@ def test_networks_includes_custom_networks( ): actual = ethereum.networks for net in ( - "goerli", "sepolia", "mainnet", LOCAL_NETWORK_NAME, diff --git a/tests/functional/test_network_api.py b/tests/functional/test_network_api.py index dd530daa2a..44f0e8ec33 100644 --- a/tests/functional/test_network_api.py +++ b/tests/functional/test_network_api.py @@ -9,7 +9,7 @@ def test_get_provider_when_not_found(ethereum): - name = "goerli-fork" + name = "sepolia-fork" network = ethereum.get_network(name) expected = f"No provider named 'test' in network '{name}' in ecosystem 'ethereum'.*" with pytest.raises(ProviderNotFoundError, match=expected): @@ -19,18 +19,18 @@ def test_get_provider_when_not_found(ethereum): @pytest.mark.parametrize("scheme", ("http", "https", "ws", "wss")) def test_get_provider_http(ethereum, scheme): uri = f"{scheme}://example.com" - network = ethereum.get_network("goerli") + network = ethereum.get_network("sepolia") actual = network.get_provider(uri) assert actual.uri == uri - assert actual.network.name == "goerli" + assert actual.network.name == "sepolia" def test_get_provider_ipc(ethereum): path = "path/to/geth.ipc" - network = ethereum.get_network("goerli") + network = ethereum.get_network("sepolia") actual = network.get_provider(path) assert actual.ipc_path == Path(path) - assert actual.network.name == "goerli" + assert actual.network.name == "sepolia" def test_get_provider_custom_network(custom_networks_config, ethereum): @@ -41,14 +41,14 @@ def test_get_provider_custom_network(custom_networks_config, ethereum): def test_block_times(ethereum): - assert ethereum.goerli.block_time == 15 + assert ethereum.sepolia.block_time == 15 def test_set_default_provider_not_exists(temp_config, ape_caplog, ethereum): bad_provider = "NOT_EXISTS" - expected = f"Provider '{bad_provider}' not found in network 'ethereum:goerli'." + expected = f"Provider '{bad_provider}' not found in network 'ethereum:sepolia'." with pytest.raises(NetworkError, match=expected): - ethereum.goerli.set_default_provider(bad_provider) + ethereum.sepolia.set_default_provider(bad_provider) def test_gas_limits(ethereum, config, project_with_source_files_contract): @@ -56,7 +56,7 @@ def test_gas_limits(ethereum, config, project_with_source_files_contract): Test the default gas limit configurations for local and live networks. """ _ = project_with_source_files_contract # Ensure use of project with default config - assert ethereum.goerli.gas_limit == "auto" + assert ethereum.sepolia.gas_limit == "auto" assert ethereum.local.gas_limit == "max" diff --git a/tests/functional/test_network_manager.py b/tests/functional/test_network_manager.py index 382c976176..134409c772 100644 --- a/tests/functional/test_network_manager.py +++ b/tests/functional/test_network_manager.py @@ -21,8 +21,6 @@ def __call__(self, *args, **kwargs) -> int: DEFAULT_CHOICES = { "::geth", "::test", - ":goerli", - ":goerli:geth", ":sepolia", ":sepolia:geth", ":local", @@ -31,8 +29,6 @@ def __call__(self, *args, **kwargs) -> int: "ethereum", "ethereum::test", "ethereum::geth", - "ethereum:goerli", - "ethereum:goerli:geth", "ethereum:sepolia", "ethereum:sepolia:geth", "ethereum:local", @@ -70,7 +66,7 @@ def fn(): @pytest.fixture def network_with_no_providers(ethereum): - network = ethereum.get_network("goerli-fork") + network = ethereum.get_network("sepolia-fork") default_provider = network.default_provider providers = network.__dict__["providers"] @@ -82,8 +78,9 @@ def network_with_no_providers(ethereum): yield network if default_provider or providers: - network._default_provider = default_provider + network._default_provider = default_provider.name network.__dict__["providers"] = providers + assert network.default_provider, "Tear-down failed - providers not set." def test_get_network_choices(networks, ethereum, mocker): @@ -128,7 +125,7 @@ def test_get_network_choices_filter_provider(networks): def test_get_provider_when_no_default(network_with_no_providers): expected = f"No default provider for network '{network_with_no_providers.name}'" with pytest.raises(NetworkError, match=expected): - # Not provider installed out-of-the-box for goerli-fork network + # Not provider installed out-of-the-box for sepolia-fork network provider = network_with_no_providers.get_provider() assert not provider, f"Provider should be None but got '{provider.name}'" @@ -148,7 +145,7 @@ def test_repr_disconnected(networks_disconnected): assert repr(networks_disconnected) == "" assert repr(networks_disconnected.ethereum) == "" assert repr(networks_disconnected.ethereum.local) == "" - assert repr(networks_disconnected.ethereum.goerli) == "" + assert repr(networks_disconnected.ethereum.sepolia) == "" def test_get_provider_from_choice_custom_provider(networks_connected_to_tester): diff --git a/tests/integration/cli/test_cache.py b/tests/integration/cli/test_cache.py index d4b3eb70d4..b528411cb2 100644 --- a/tests/integration/cli/test_cache.py +++ b/tests/integration/cli/test_cache.py @@ -3,8 +3,8 @@ @run_once def test_cache_init_purge(ape_cli, runner): - cmd = ("cache", "init", "--network", "ethereum:goerli") + cmd = ("cache", "init", "--network", "ethereum:sepolia") result = runner.invoke(ape_cli, cmd) - assert result.output == "SUCCESS: Caching database initialized for ethereum:goerli.\n" - result = runner.invoke(ape_cli, ("cache", "purge", "--network", "ethereum:goerli")) - assert result.output == "SUCCESS: Caching database purged for ethereum:goerli.\n" + assert result.output == "SUCCESS: Caching database initialized for ethereum:sepolia.\n" + result = runner.invoke(ape_cli, ("cache", "purge", "--network", "ethereum:sepolia")) + assert result.output == "SUCCESS: Caching database purged for ethereum:sepolia.\n" diff --git a/tests/integration/cli/test_networks.py b/tests/integration/cli/test_networks.py index 597e82229a..fcf02689cd 100644 --- a/tests/integration/cli/test_networks.py +++ b/tests/integration/cli/test_networks.py @@ -5,8 +5,6 @@ _DEFAULT_NETWORKS_TREE = """ ethereum (default) -├── goerli -│ └── geth (default) ├── local (default) │ ├── geth │ └── test (default) @@ -20,12 +18,6 @@ - isDefault: true name: ethereum networks: - - name: goerli - providers: - - isDefault: true - name: geth - - name: goerli-fork - providers: [] - isDefault: true name: local providers: @@ -47,7 +39,7 @@ """ _GETH_NETWORKS_TREE = """ ethereum (default) -├── goerli +├── sepolia │ └── geth (default) ├── local (default) │ └── geth (default) @@ -59,9 +51,9 @@ └── local (default) └── test (default) """ -_GOERLI_NETWORK_TREE_OUTPUT = """ +_SEPOLIA_NETWORK_TREE_OUTPUT = """ ethereum (default) -└── goerli +└── sepolia └── geth (default) """ _CUSTOM_NETWORKS_TREE = """ @@ -70,7 +62,7 @@ │ └── geth (default) ├── apenet1 │ └── geth (default) -├── goerli +├── sepolia │ └── geth (default) ├── local (default) │ └── geth (default) @@ -102,7 +94,7 @@ def assert_rich_text(actual: str, expected: str): @run_once def test_list(ape_cli, runner): - result = runner.invoke(ape_cli, ["networks", "list"]) + result = runner.invoke(ape_cli, ("networks", "list")) # Grab ethereum actual = "ethereum (default)\n" + "".join(result.output.split("ethereum (default)\n")[-1]) @@ -113,7 +105,7 @@ def test_list(ape_cli, runner): @run_once def test_list_yaml(ape_cli, runner): result = runner.invoke( - ape_cli, ["networks", "list", "--format", "yaml"], catch_exceptions=False + ape_cli, ("networks", "list", "--format", "yaml"), catch_exceptions=False ) expected_lines = _DEFAULT_NETWORKS_YAML.strip().split("\n") @@ -134,8 +126,8 @@ def test_list_yaml(ape_cli, runner): @skip_projects_except("geth") -def test_list_geth(ape_cli, runner, networks, project): - result = runner.invoke(ape_cli, ["networks", "list"]) +def test_list_geth(ape_cli, runner, networks): + result = runner.invoke(ape_cli, ("networks", "list")) # Grab ethereum actual = "ethereum (default)\n" + "".join(result.output.split("ethereum (default)\n")[-1]) @@ -150,18 +142,18 @@ def test_list_geth(ape_cli, runner, networks, project): @run_once -def test_list_filter_networks(ape_cli, runner, networks): - result = runner.invoke(ape_cli, ["networks", "list", "--network", "goerli"]) +def test_list_filter_networks(ape_cli, runner): + result = runner.invoke(ape_cli, ("networks", "list", "--network", "sepolia")) # Grab ethereum actual = "ethereum (default)\n" + "".join(result.output.split("ethereum (default)\n")[-1]) - assert_rich_text(actual, _GOERLI_NETWORK_TREE_OUTPUT) + assert_rich_text(actual, _SEPOLIA_NETWORK_TREE_OUTPUT) @run_once -def test_list_filter_providers(ape_cli, runner, networks): - result = runner.invoke(ape_cli, ["networks", "list", "--provider", "test"]) +def test_list_filter_providers(ape_cli, runner): + result = runner.invoke(ape_cli, ("networks", "list", "--provider", "test")) # Grab ethereum actual = "ethereum (default)\n" + "".join(result.output.split("ethereum (default)\n")[-1]) @@ -171,7 +163,7 @@ def test_list_filter_providers(ape_cli, runner, networks): @skip_projects_except("geth") def test_list_custom_networks(ape_cli, runner): - result = runner.invoke(ape_cli, ["networks", "list"]) + result = runner.invoke(ape_cli, ("networks", "list")) actual = "ethereum (default)\n" + "".join(result.output.split("ethereum (default)\n")[-1]) assert_rich_text(actual, _CUSTOM_NETWORKS_TREE)