Skip to content

Checksum address uniffi#1115

Draft
DRadmir wants to merge 4 commits into
mainfrom
checksum-address-uniffi
Draft

Checksum address uniffi#1115
DRadmir wants to merge 4 commits into
mainfrom
checksum-address-uniffi

Conversation

@DRadmir
Copy link
Copy Markdown
Contributor

@DRadmir DRadmir commented May 10, 2026

No description provided.

DRadmir added 2 commits May 7, 2026 17:52
Wraps gem_evm::ethereum_address_checksum, returning the input unchanged
for non-EVM chains and on parse errors. Used by iOS/Android clients to
normalize EVM recipient addresses to EIP-55 format at input boundaries
(paste, QR scan, name resolution).
@DRadmir DRadmir self-assigned this May 10, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new checksum_address function in gemstone/src/address.rs to provide EIP-55 checksumming for Ethereum-based chains, along with corresponding unit tests. Feedback suggests including ChainType::HyperCore in the checksum logic to maintain consistency with existing address validation patterns for EVM-compatible chains.

Comment thread gemstone/src/address.rs Outdated
Comment on lines +58 to +61
match chain.chain_type() {
ChainType::Ethereum => ethereum_address_checksum(address).unwrap_or_else(|_| address.to_string()),
_ => address.to_string(),
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The checksum_address function should include ChainType::HyperCore in the match arm. Since HyperCore is treated as an EVM-compatible chain in validate_address (line 34), it should also support EIP-55 checksumming to maintain consistency across the address utility functions.

Suggested change
match chain.chain_type() {
ChainType::Ethereum => ethereum_address_checksum(address).unwrap_or_else(|_| address.to_string()),
_ => address.to_string(),
}
match chain.chain_type() {
ChainType::Ethereum | ChainType::HyperCore => ethereum_address_checksum(address).unwrap_or_else(|_| address.to_string()),
_ => address.to_string(),
}

@0xh3rman
Copy link
Copy Markdown
Collaborator

We have GemChainAddress now, EthereumAddress implements AddressTrait and encode already returns checksummed address, we should move this normalization step to GemChainAddress::address method

DRadmir added 2 commits May 12, 2026 10:57
EthereumAddress::encode() already returns EIP-55 form via AddressTrait,
so the constructor now stores the normalized form for EVM chains. Drops
the separate checksum_address uniffi function — callers can use
GemChainAddress(address, chain).address() to get the normalized result.
@DRadmir DRadmir marked this pull request as draft May 12, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants