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

refactor!: use new types from eth_pydantic_types #2322

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions src/ape/types/address.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import TYPE_CHECKING, Annotated, Any, Optional, Union

from eth_pydantic_types import Address as _Address
from eth_pydantic_types import HashBytes20, HashStr20
from eth_pydantic_types import HexBytes20, HexStr20
from eth_typing import ChecksumAddress

from ape.utils.basemodel import ManagerAccessMixin
Expand All @@ -10,7 +10,7 @@
from pydantic_core.core_schema import ValidationInfo


RawAddress = Union[str, int, HashStr20, HashBytes20]
RawAddress = Union[str, int, HexStr20, HexBytes20]
"""
A raw data-type representation of an address.
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/geth/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional, cast

import pytest
from eth_pydantic_types import HashBytes32
from eth_pydantic_types import HexBytes32
from eth_typing import HexStr
from eth_utils import keccak, to_hex
from hexbytes import HexBytes
Expand Down Expand Up @@ -532,7 +532,7 @@ def test_send_transaction_when_no_error_and_receipt_fails(
geth_provider._web3 = mock_web3
# Getting a receipt "works", but you get a failed one.
# NOTE: Value is meaningless.
tx_hash = HashBytes32.__eth_pydantic_validate__(123**36)
tx_hash = HexBytes32.__eth_pydantic_validate__(123**36)
receipt_data = {
"failed": True,
"blockNumber": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/geth/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
LOCAL_TRACE = r"""
Call trace for '0x([A-Fa-f0-9]{64})'
tx\.origin=0x[a-fA-F0-9]{40}
ContractA\.methodWithoutArguments\(\) -> 0x[A-Fa-f0-9]{2,}..[A-Fa-f0-9]{4} \[\d+ gas\]
ContractA\.methodWithoutArguments\(\) -> 0x[A-Fa-f0-9]{4}..[A-Fa-f0-9]{4} \[\d+ gas\]
├── SYMBOL\.supercluster\(x=234444\) -> \[
│ \[23523523235235, 11111111111, 234444\],
│ \[
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, ClassVar, cast

import pytest
from eth_pydantic_types import HashBytes32, HexBytes
from eth_pydantic_types import HexBytes32, HexBytes
from eth_typing import HexAddress, HexStr
from ethpm_types import ContractType, ErrorABI
from ethpm_types.abi import ABIType, EventABI, MethodABI
Expand Down Expand Up @@ -743,7 +743,7 @@ def test_encode_blueprint_contract(ethereum, vyper_contract_type):

def test_decode_returndata(ethereum):
abi = make_method_abi("doThing", outputs=[{"name": "", "type": "bool"}])
data = HashBytes32.__eth_pydantic_validate__(0)
data = HexBytes32.__eth_pydantic_validate__(0)
actual = ethereum.decode_returndata(abi, data)
assert actual == (False,)

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest import mock

import pytest
from eth_pydantic_types import HashBytes32
from eth_pydantic_types import HexBytes32
from eth_tester.exceptions import TransactionFailed # type: ignore
from eth_typing import HexStr
from eth_utils import ValidationError, to_hex
Expand Down Expand Up @@ -426,7 +426,7 @@ def test_send_transaction_when_no_error_and_receipt_fails(

try:
# NOTE: Value is meaningless.
tx_hash = HashBytes32.__eth_pydantic_validate__(123**36)
tx_hash = HexBytes32.__eth_pydantic_validate__(123**36)

# Sending tx "works" meaning no vm error.
mock_eth_tester.ethereum_tester.send_raw_transaction.return_value = tx_hash
Expand Down
Loading