fix(token-registry): convert CIP-26 logo from hex to base64 before re…#751
Open
ghost wants to merge 3 commits into
Open
fix(token-registry): convert CIP-26 logo from hex to base64 before re…#751ghost wants to merge 3 commits into
ghost wants to merge 3 commits into
Conversation
Contributor
❌ Preprod Tests: FAILEDTests run against preprod network with live blockchain data |
Contributor
❌ Preprod Tests: FAILEDTests run against preprod network with live blockchain data |
Contributor
✅ Preprod Tests: PASSEDTests run against preprod network with live blockchain data |
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: #748
Summary
When the token registry API returns logo data for CIP-26 tokens, the
logo.valuefield contained raw hex-encoded bytes (e.g.89504e470d0a…) instead of the base64-encoded string that the CIP-26 specification and theLogoType.format = "base64"contract both require. This broke logo rendering in every consuming client (wallets,dApps) that treated the value as a base64 image URI.Changes
Fix —
TokenRegistryServiceImplAdded
@Slf4jfor structured warning logs.Extracted a new private helper
encodeLogoValue()that converts ahex string to standard base64 using
HexFormatandBase64fromjava.util(no new dependencies).Updated
convertToLogoData()to call the helper for CIP-26 logos.Edge cases handled:
nullvalueLogoData { format: BASE64, value: null }(unchanged)nulllogo (field omitted)nulllogo +WARNlogTests —
TokenRegistryServiceImplTestshouldConvertCip26LogoToBase64: now passes real hex inputand asserts the correctly converted base64 output.
shouldHandleCaseInsensitiveCipStandards: uses valid hex andasserts base64 output.
shouldExtractCompleteMetadataWhenFullDataAvailable: helpernow uses valid hex logo fixture.
shouldReturnNullLogoForMalformedHex(odd-length hex → null).shouldReturnNullLogoForEmptyHexValue(empty string → null).shouldNotConvertCip68UrlLogo(CIP-68 URL regression guard).Behavioral tests
network_test_data.yaml: updatedlogo_value_prefixfrom"89504e47"(hex PNG magic bytes) to"iVBORw"(base64 PNG prefix) for all CIP-26 tokens on preprod and mainnet.test_token_registry.py: parity test now converts the upstream registry's raw hex value to base64 before comparing with Rosetta's response.network_options_operation_types.json: bumpedmiddleware_versionfrom2.1.2to2.2.0.