diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4fa5c77..b18e189 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.4.0 hooks: - id: check-yaml @@ -10,24 +10,24 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black name: black - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.5.1 hooks: - id: mypy additional_dependencies: [types-PyYAML, types-requests, types-setuptools, pydantic] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.14 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [mdformat-gfm, mdformat-frontmatter] diff --git a/ape_foundry/provider.py b/ape_foundry/provider.py index 72c0b0b..2120e47 100644 --- a/ape_foundry/provider.py +++ b/ape_foundry/provider.py @@ -802,10 +802,17 @@ def _eth_call(self, arguments: List) -> bytes: try: result = self._make_request("eth_call", arguments) except Exception as err: - trace = (self._create_trace_frame(x) for x in self._trace_call(arguments)[1]) + trace, trace2 = tee(self._create_trace_frame(x) for x in self._trace_call(arguments)[1]) contract_address = arguments[0]["to"] + contract_type = self.chain_manager.contracts.get(contract_address) + method_id = arguments[0].get("data", "")[:10] or None + tb = ( + SourceTraceback.create(contract_type, trace, method_id) + if method_id and contract_type + else None + ) raise self.get_virtual_machine_error( - err, trace=trace, contract_address=contract_address + err, trace=trace2, contract_address=contract_address, source_traceback=tb ) from err return HexBytes(result) diff --git a/setup.py b/setup.py index a3b6d97..2cc5ede 100644 --- a/setup.py +++ b/setup.py @@ -13,14 +13,14 @@ "ape-polygon", # For running polygon fork tests ], "lint": [ - "black>=23.3.0,<24", # auto-formatter and linter - "mypy>=0.991,<1", # Static type analyzer + "black>=23.7.0,<24", # auto-formatter and linter + "mypy>=1.5.1,<2", # Static type analyzer "types-requests", # Needed due to mypy typeshed "types-setuptools", # Needed due to mypy typeshed "types-PyYAML", # Needed due to mypy typeshed - "flake8>=6.0.0,<7", # Style linter - "isort>=5.10.1,<6", # Import sorting linter - "mdformat>=0.7.16", # Auto-formatter for markdown + "flake8>=6.0.1,<7", # Style linter + "isort>=<5.10.1,<6", # Import sorting linter + "mdformat>=0.7.17", # Auto-formatter for markdown "mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown "mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates ], diff --git a/tests/test_provider.py b/tests/test_provider.py index 4c7fd8d..5787812 100644 --- a/tests/test_provider.py +++ b/tests/test_provider.py @@ -195,7 +195,7 @@ def test_set_code(connected_provider, contract_container, owner): contract = contract_container.deploy(sender=owner) provider = connected_provider code = provider.get_code(contract.address) - assert type(code) == HexBytes + assert type(code) is HexBytes assert provider.set_code(contract.address, "0x00") is True assert provider.get_code(contract.address) != code assert provider.set_code(contract.address, code) is True