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

feat: use checksummed address over normalized #152

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions eth_abi/decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from eth_utils import (
big_endian_to_int,
to_normalized_address,
to_checksum_address,
to_tuple,
)

Expand Down Expand Up @@ -365,7 +365,7 @@ def from_type_str(cls, abi_type, registry):
class AddressDecoder(Fixed32ByteSizeDecoder):
value_bit_size = 20 * 8
is_big_endian = True
decoder_fn = staticmethod(to_normalized_address)
decoder_fn = staticmethod(to_checksum_address)

@parse_type_str('address')
def from_type_str(cls, abi_type, registry):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_decoding/test_decoder_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
big_endian_to_int,
decode_hex,
int_to_big_endian,
to_normalized_address,
to_checksum_address,
)
from eth_utils.toolz import (
complement,
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_decode_address(address_bytes, padding_size, data_byte_size):
else:
decoded_value = decoder(stream)

actual_value = to_normalized_address(stream_bytes[:data_byte_size][-20:])
actual_value = to_checksum_address(stream_bytes[:data_byte_size][-20:])

assert decoded_value == actual_value

Expand Down