From a5a44094f0767ab0a1ad2915a6aca0d8bae4a083 Mon Sep 17 00:00:00 2001 From: antazoey Date: Mon, 6 Jan 2025 16:58:28 -0600 Subject: [PATCH] refactor: change chain ID --- src/ape/utils/testing.py | 2 +- tests/functional/geth/test_provider.py | 11 ++++++----- tests/functional/geth/test_trace.py | 2 +- tests/functional/test_exceptions.py | 3 ++- tests/integration/cli/test_console.py | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ape/utils/testing.py b/src/ape/utils/testing.py index cc2ed7d3d4..5229756fae 100644 --- a/src/ape/utils/testing.py +++ b/src/ape/utils/testing.py @@ -5,7 +5,7 @@ DEFAULT_NUMBER_OF_TEST_ACCOUNTS = 10 DEFAULT_TEST_MNEMONIC = "test test test test test test test test test test test junk" DEFAULT_TEST_HD_PATH = "m/44'/60'/0'/0" -DEFAULT_TEST_CHAIN_ID = 1337 +DEFAULT_TEST_CHAIN_ID = 31337 DEFAULT_TEST_ACCOUNT_BALANCE = int(10e21) # 10,000 Ether (in Wei) GeneratedDevAccount = namedtuple("GeneratedDevAccount", ("address", "private_key")) """ diff --git a/tests/functional/geth/test_provider.py b/tests/functional/geth/test_provider.py index cf43f8c42b..f943688a98 100644 --- a/tests/functional/geth/test_provider.py +++ b/tests/functional/geth/test_provider.py @@ -25,6 +25,7 @@ VirtualMachineError, ) from ape.utils import to_int +from ape.utils.testing import DEFAULT_TEST_CHAIN_ID from ape_ethereum.ecosystem import Block from ape_ethereum.provider import DEFAULT_SETTINGS, EthereumNodeProvider from ape_ethereum.trace import TraceApproach @@ -53,7 +54,7 @@ def process_factory_patch(mocker): def tx_for_call(geth_contract): return DynamicFeeTransaction.model_validate( { - "chainId": 1337, + "chainId": DEFAULT_TEST_CHAIN_ID, "to": geth_contract.address, "gas": 4716984, "value": 0, @@ -146,7 +147,7 @@ def test_uri_invalid(geth_provider, project, ethereum): @geth_process_test def test_repr_connected(geth_provider): actual = repr(geth_provider) - expected = f"" + expected = f"" assert actual == expected @@ -158,7 +159,7 @@ def test_repr_on_local_network_and_disconnected(networks): node._web3 = None actual = repr(node) - expected = "" + expected = f"" assert actual == expected if w3: @@ -184,7 +185,7 @@ def test_get_logs(geth_contract, geth_account): @geth_process_test def test_chain_id_when_connected(geth_provider): - assert geth_provider.chain_id == 1337 + assert geth_provider.chain_id == DEFAULT_TEST_CHAIN_ID @geth_process_test @@ -207,7 +208,7 @@ def test_chain_id_live_network_connected_uses_web3_chain_id(mocker, geth_provide geth_provider.network = orig_network # Still use the connected chain ID instead network's - assert actual == 1337 + assert actual == DEFAULT_TEST_CHAIN_ID @geth_process_test diff --git a/tests/functional/geth/test_trace.py b/tests/functional/geth/test_trace.py index 3a3815c477..5301108dcd 100644 --- a/tests/functional/geth/test_trace.py +++ b/tests/functional/geth/test_trace.py @@ -302,7 +302,7 @@ def test_printing_debug_logs_compat(geth_provider, geth_account, vyper_printing) @geth_process_test def test_call_trace_supports_debug_trace_call(geth_contract, geth_account): tx = { - "chainId": "0x539", + "chainId": "0x7a69", "to": "0x77c7E3905c21177Be97956c6620567596492C497", "value": "0x0", "data": "0x23fd0e40", diff --git a/tests/functional/test_exceptions.py b/tests/functional/test_exceptions.py index 3b3788848e..8ccae1901d 100644 --- a/tests/functional/test_exceptions.py +++ b/tests/functional/test_exceptions.py @@ -16,6 +16,7 @@ ) from ape.types.trace import SourceTraceback from ape.utils.misc import ZERO_ADDRESS +from ape.utils.testing import DEFAULT_TEST_CHAIN_ID from ape_ethereum.transactions import DynamicFeeTransaction, Receipt @@ -23,7 +24,7 @@ def failing_call(): # A call (tx without sender) data = { - "chainId": 1337, + "chainId": DEFAULT_TEST_CHAIN_ID, "to": "0x5FbDB2315678afecb367f032d93F642f64180aa3", "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "gas": 30029122, diff --git a/tests/integration/cli/test_console.py b/tests/integration/cli/test_console.py index 171ac3311b..64acda7ff1 100644 --- a/tests/integration/cli/test_console.py +++ b/tests/integration/cli/test_console.py @@ -5,6 +5,7 @@ import pytest from ape import __all__ +from ape.utils.testing import DEFAULT_TEST_CHAIN_ID from tests.conftest import ApeSubprocessRunner from tests.integration.cli.utils import skip_projects, skip_projects_except @@ -320,5 +321,5 @@ def test_console_code(integ_project, mocker, console_runner): result = console_runner.invoke( "--project", f"{integ_project.path}", "--code", "chain\nx = 3\nx + 1" ) - expected = "Out[1]: \nOut[3]: 4\n" + expected = f"Out[1]: \nOut[3]: 4\n" assert result.output == expected