Skip to content

Commit

Permalink
chore: bump eth dependencies (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Aug 16, 2024
1 parent dbbd986 commit d8bba70
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.11.1
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-requests, types-setuptools, pydantic]
Expand Down
8 changes: 4 additions & 4 deletions evm_trace/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import TYPE_CHECKING, Optional, Union, cast

from eth_typing import ChecksumAddress
from eth_utils import to_checksum_address
from eth_utils import to_checksum_address, to_hex

from evm_trace.enums import CallType

Expand Down Expand Up @@ -56,11 +56,11 @@ def title(self) -> str:

if hasattr(self.call, "selector"):
# Is an Event-node
selector = self.call.selector.hex() if self.call.selector else None
selector = to_hex(self.call.selector) if self.call.selector else None
return f"{call_type}: {selector}"
# else: Is a CallTreeNode

address_hex_str = self.call.address.hex() if self.call.address else None
address_hex_str = to_hex(self.call.address) if self.call.address else None
try:
address = to_checksum_address(address_hex_str) if address_hex_str else None
except (ImportError, ValueError):
Expand All @@ -80,7 +80,7 @@ def title(self) -> str:
method_id = ""

else:
hex_id = self.call.calldata[:4].hex()
hex_id = to_hex(self.call.calldata[:4])
method_id = f"<{hex_id}>" if hex_id else ""

sep = "." if call_path and method_id else ""
Expand Down
8 changes: 4 additions & 4 deletions evm_trace/geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional

from eth_pydantic_types import HashBytes20, HexBytes
from eth_utils import to_int
from eth_utils import to_hex, to_int
from pydantic import Field, RootModel, field_validator

from evm_trace.base import BaseModel, CallTreeNode, EventNode
Expand Down Expand Up @@ -188,7 +188,7 @@ def create_call_node_data(frame: TraceFrame) -> dict:
data: dict = {"address": frame.address, "depth": frame.depth}
if frame.op == CallType.CALL.value:
data["call_type"] = CallType.CALL
data["value"] = int(frame.stack[-3].hex(), 16)
data["value"] = int(to_hex(frame.stack[-3]), 16)
data["calldata"] = frame.memory.get(frame.stack[-4], frame.stack[-5])
elif frame.op == CallType.DELEGATECALL.value:
data["call_type"] = CallType.DELEGATECALL
Expand All @@ -197,10 +197,10 @@ def create_call_node_data(frame: TraceFrame) -> dict:
# `calldata` and `address` are handle in later frames for CREATE and CREATE2.
elif frame.op == CallType.CREATE.value:
data["call_type"] = CallType.CREATE
data["value"] = int(frame.stack[-1].hex(), 16)
data["value"] = int(to_hex(frame.stack[-1]), 16)
elif frame.op == CallType.CREATE2.value:
data["call_type"] = CallType.CREATE2
data["value"] = int(frame.stack[-1].hex(), 16)
data["value"] = int(to_hex(frame.stack[-1]), 16)

else:
data["call_type"] = CallType.STATICCALL
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exclude =
docs
build
evm_trace/version.py
ignore = E704,W503,PYD002
per-file-ignores =
# The traces have to be formatted this way for the tests.
tests/expected_traces.py: E501
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"eth-hash[pysha3]", # For eth-utils address checksumming
],
"lint": [
"black>=24.4.2,<25", # Auto-formatter and linter
"mypy>=1.10.0,<2", # Static type analyzer
"black>=24.8.0,<25", # Auto-formatter and linter
"mypy>=1.11.1,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"flake8>=7.0.0,<8", # Style linter
"flake8>=7.1.1,<8", # Style linter
"flake8-breakpoint>=1.1.0,<2", # Detect breakpoints left in code
"flake8-print>=5.0.0,<6", # Detect print statements left in code
"isort>=5.10.1,<6", # Import sorting linter
Expand Down Expand Up @@ -61,10 +61,10 @@
include_package_data=True,
install_requires=[
"pydantic>=2.5.2,<3",
"py-evm>=0.10.0b6,<0.11",
"eth-utils>=2.3.1,<3",
"py-evm>=0.10.1b1,<0.11",
"eth-utils",
"msgspec>=0.8",
"eth-pydantic-types>=0.1.0a5",
"eth-pydantic-types>=0.1.1,<0.2",
],
python_requires=">=3.9,<4",
extras_require=extras_require,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from eth_pydantic_types import HexBytes
from eth_utils import to_checksum_address
from eth_utils import to_checksum_address, to_hex
from pydantic import ValidationError

from evm_trace.enums import CallType
Expand Down Expand Up @@ -240,7 +240,7 @@ def test_create_trace_frames_from_geth_create2_struct_logs(
for frame in frames:
if frame.op.startswith("CREATE"):
assert frame.address
address = frame.address.hex()
address = to_hex(frame.address)
assert address.startswith("0x")
assert len(address) == 42
create2_found = create2_found or frame.op == "CREATE2"
Expand Down

0 comments on commit d8bba70

Please sign in to comment.