Update Address Validation and Metadata Descriptions in Contracts#143
Conversation
- Modified the address validation method in `Erc721EthscriptionsCollectionParser` to be case-insensitive for Ethereum addresses. - Updated the description in the `NameRegistry` contract to clarify the purpose of the Ethscriptions name and allowed characters. - Enhanced metadata attributes to include the length of the name, improving the representation of domain characteristics.
There was a problem hiding this comment.
Pull Request Overview
This PR updates the address validation and metadata descriptions in the Name Registry system. The changes make address validation case-insensitive and improve the clarity of metadata descriptions to better reflect the system's purpose.
- Modified address validation in the Ruby parser to accept both lowercase and uppercase hex characters
- Updated metadata descriptions to clarify the Ethscriptions name system and its character constraints
- Changed token metadata attributes from displaying the name to displaying the name length as a numeric property
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| contracts/src/NameRegistry.sol | Updated token and contract metadata descriptions to clarify allowed characters and name constraints; changed attributes from displaying name to length |
| app/models/erc721_ethscriptions_collection_parser.rb | Made address validation case-insensitive by adding the i flag to the regex pattern |
Comments suppressed due to low confidence (2)
app/models/erc721_ethscriptions_collection_parser.rb:505
- The
validate_bytes32method should also use case-insensitive matching (add/iflag) to be consistent with the updatedvalidate_addressmethod, as Ethereum hex strings can have uppercase characters (e.g., in EIP-55 checksummed addresses or other hex data).
def validate_bytes32(value, field_name)
unless value.is_a?(String) && value.match?(/\A0x[0-9a-f]{64}\z/)
raise ValidationError, "Invalid bytes32 for #{field_name}: #{value}"
end
app/models/erc721_ethscriptions_collection_parser.rb:530
- The
validate_bytes32_arraymethod should also use case-insensitive matching (add/iflag) to be consistent with the updatedvalidate_addressmethod and the suggested fix forvalidate_bytes32.
unless item.is_a?(String) && item.match?(/\A0x[0-9a-f]{64}\z/)
raise ValidationError, "Invalid bytes32 in array: #{item}"
end
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| def validate_address(value, field_name) | ||
| unless value.is_a?(String) && value.match?(/\A0x[0-9a-f]{40}\z/) | ||
| unless value.is_a?(String) && value.match?(/\A0x[0-9a-f]{40}\z/i) |
There was a problem hiding this comment.
Bug: Inconsistent Case Sensitivity Bypasses Validation
The validate_address method now accepts case-insensitive addresses via the /i regex flag, but the zero address check on line 515 uses a case-sensitive string comparison. This allows uppercase or mixed-case variants of the zero address (like 0x0000000000000000000000000000000000000000 with capital letters) to bypass the zero address validation, even though they represent the same address. The check needs to compare the downcased value or normalize before comparing.
Erc721EthscriptionsCollectionParserto be case-insensitive for Ethereum addresses.NameRegistrycontract to clarify the purpose of the Ethscriptions name and allowed characters.Note
Makes Ethereum address validation case-insensitive and revises NameRegistry token/collection metadata (description and attributes).
app/models/erc721_ethscriptions_collection_parser.rb):validate_addressnow accepts mixed-case hex via case-insensitive regex (/i), still normalizing to lowercase.contracts/src/NameRegistry.sol):tokenURI):Nameattribute with numericLengthattribute (display_type: number).contractURI):Written by Cursor Bugbot for commit 423fd7c. This will update automatically on new commits. Configure here.