Skip to content

Commit

Permalink
fix: use str type with bytes validator (#2340)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Oct 25, 2024
1 parent 85eddb8 commit a24374b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/ape_ethereum/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from functools import cached_property
from typing import IO, Any, Optional, Union

from eth_pydantic_types import HexStr
from eth_utils import is_0x_prefixed, to_hex
from ethpm_types import ContractType, MethodABI
from evm_trace import (
Expand Down Expand Up @@ -447,7 +448,7 @@ def _get_abi(self, call: dict) -> Optional[MethodABI]:


class TransactionTrace(Trace):
transaction_hash: str
transaction_hash: HexStr
debug_trace_transaction_parameters: dict = {"enableMemory": True}
_frames: list[dict] = []

Expand Down
5 changes: 3 additions & 2 deletions tests/functional/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ def test_get_gas_report_with_sub_calls(simple_trace_cls):
assert len(actual) > 1 # Sub-contract calls!


def test_transaction_trace_create(vyper_contract_instance):
tx_hash = vyper_contract_instance.creation_metadata.txn_hash
@pytest.mark.parametrize("txn_hash_callback", (str, HexBytes))
def test_transaction_trace_create(vyper_contract_instance, txn_hash_callback):
tx_hash = txn_hash_callback(vyper_contract_instance.creation_metadata.txn_hash)
trace = TransactionTrace(transaction_hash=tx_hash)
actual = f"{trace}"
expected = r"VyperContract\.__new__\(num=0\) \[\d+ gas\]"
Expand Down

0 comments on commit a24374b

Please sign in to comment.