Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use str type with bytes validator #2340

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading