Fix address parsing and display errors#229
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes address parsing and display by improving the human_arg/2 function to properly handle binary addresses and enforce EIP-55 checksum formatting. The key issue was that binary addresses starting with bytes 0x30 and 0x78 (representing the string "0x") were incorrectly parsed as hex strings.
Key Changes:
- Updated
human_arg/2to use pattern matching for exact binary size validation and apply checksumming to all addresses - Modified
prepare_arg/2andto_checksum_address/2to use stricter pattern matching for hex address strings - Updated all test fixtures to use checksummed addresses for consistency
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/ethers/utils.ex | Core fix: improved binary pattern matching for addresses and added checksumming logic to human_arg/2 |
| test/ethers/utils_test.exs | Added regression tests for binary address handling and checksumming behavior |
| test/ethers/types_contract_test.exs | Updated address fixture to use checksummed format |
| test/ethers/registry_contract_test.exs | Updated address fixture to use checksummed format |
| test/ethers/owner_contract_test.exs | Updated address fixture to use checksummed format |
| test/ethers/event_mixed_index_contract_test.exs | Updated address fixtures in test assertions to match new checksummed output |
| CHANGELOG.md | Documented breaking change and bug fix for address handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes parsing of address and displaying it using human_arg/2 function in Utils.