Skip to content

Commit a3f17aa

Browse files
feat: implement cchecksum for ~2x faster checksumming (#2404)
Co-authored-by: Juliya Smith <jules@apeworx.io>
1 parent be5be1c commit a3f17aa

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"ipython>=8.18.1,<9",
100100
"lazyasd>=0.1.4",
101101
"asttokens>=2.4.1,<3", # Peer dependency; w/o pin container build fails.
102+
"cchecksum>=0.0.3,<1",
102103
# Pandas peer-dep: Numpy 2.0 causes issues for some users.
103104
"numpy<2",
104105
"packaging>=23.0,<24",

src/ape/managers/converters.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55
from functools import cached_property
66
from typing import TYPE_CHECKING, Any, Union
77

8+
from cchecksum import to_checksum_address
89
from dateutil.parser import parse
910
from eth_pydantic_types import Address, HexBytes
1011
from eth_typing.evm import ChecksumAddress
11-
from eth_utils import (
12-
is_0x_prefixed,
13-
is_checksum_address,
14-
is_hex,
15-
is_hex_address,
16-
to_checksum_address,
17-
to_int,
18-
)
12+
from eth_utils import is_0x_prefixed, is_checksum_address, is_hex, is_hex_address, to_int
1913

2014
from ape.api.address import BaseAddress
2115
from ape.api.convert import ConverterAPI

src/ape_accounts/_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from typing import TYPE_CHECKING, Optional
44

55
import click
6-
from eth_utils import to_checksum_address, to_hex
6+
from cchecksum import to_checksum_address
7+
from eth_utils import to_hex
78

89
from ape.cli.arguments import existing_alias_argument, non_existing_alias_argument
910
from ape.cli.options import ape_cli_context

src/ape_ethereum/ecosystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from functools import cached_property
55
from typing import TYPE_CHECKING, Any, ClassVar, Optional, Union, cast
66

7+
from cchecksum import to_checksum_address
78
from eth_abi import decode, encode
89
from eth_abi.exceptions import InsufficientDataBytes, NonEmptyPaddingBytes
910
from eth_pydantic_types import HexBytes
@@ -17,7 +18,6 @@
1718
is_hex_address,
1819
keccak,
1920
to_bytes,
20-
to_checksum_address,
2121
to_hex,
2222
)
2323
from ethpm_types.abi import ABIType, ConstructorABI, EventABI, MethodABI

0 commit comments

Comments
 (0)