Skip to content

Conversation

@philipliu
Copy link
Contributor

What

This PR makes the asset codes case sensitive everywhere in the codebase. Since assets that are enabled by default, and assets added through the asset API are uppercased before being persisted, disbursements with these assets should not break from upgrading. However, if assets with lowercase asset codes were added to the database, existing disbursements will break. This is considered an edge case, and we should note that the user should audit their assets table and fix any assets before upgrading.

Detect problematic assets:

SELECT id, code, issuer FROM assets WHERE code != UPPER(code);  

Fix problematic assets:

UPDATE assets SET code = UPPER(code) WHERE code != UPPER(code);

Why

Stellar asset codes are case sensitive, so we shouldn't be uppercasing asset codes.

Known limitations

N/A

Checklist

  • Title follows SDP-1234: Add new feature or Chore: Refactor package xyz format. The Jira ticket code was included if available.
  • PR has a focused scope and doesn't mix features with refactoring
  • Tests are included (if applicable)
  • CHANGELOG.md is updated (if applicable)
  • CONFIG/SECRETS changes are updated in helmcharts and deployments (if applicable)
  • Preview deployment works as expected
  • Ready for production

@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) December 3, 2025 15:40 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Internal SEP Tests December 3, 2025 15:40 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@philipliu philipliu force-pushed the philip/asset-code-casing branch from 9767f36 to 6c07f85 Compare December 3, 2025 15:45
@philipliu philipliu temporarily deployed to Internal SEP Tests December 3, 2025 15:45 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) December 3, 2025 15:45 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@philipliu philipliu marked this pull request as ready for review December 3, 2025 15:51
Copilot AI review requested due to automatic review settings December 3, 2025 15:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes case-insensitive comparisons for asset codes throughout the codebase, making them case-sensitive to align with Stellar's asset code standards. The changes replace strings.ToUpper() and strings.EqualFold() calls with direct equality checks, and introduce a new constant XLMAssetCodeAlias for the "NATIVE" alias. Only uppercase "XLM" and "NATIVE" are now recognized as native asset codes.

Key changes:

  • Removed case-insensitive string operations (ToUpper(), EqualFold()) from asset code comparisons
  • Added XLMAssetCodeAlias constant with value "NATIVE" alongside existing XLMAssetCode ("XLM")
  • Updated all native asset checks to explicitly compare against both "XLM" and "NATIVE" constants

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/services/assets/assets_pubnet.go Added XLMAssetCodeAlias constant for "NATIVE"
internal/data/assets.go Replaced case-insensitive comparisons with case-sensitive equality checks for asset codes
internal/data/assets_test.go Updated test cases to verify case-sensitive behavior
internal/data/fixtures.go Updated fixture creation to check for both "XLM" and "NATIVE" explicitly
internal/transactionsubmission/transaction_worker.go Replaced case-insensitive XLM check with explicit constant comparisons
internal/transactionsubmission/transaction_worker_test.go Updated test to use asset constants instead of case-insensitive comparison
internal/transactionsubmission/services/horizon.go Removed uppercasing from asset ID formatting
internal/services/payment_to_submitter_service.go Updated payment validation to use case-sensitive asset code checks
internal/services/send_receiver_wallets_invite_service.go Updated native asset detection to use exact constant matches
internal/services/send_receiver_wallets_invite_service_test.go Added test cases for case-sensitive asset code behavior
internal/serve/httphandler/assets_handler.go Removed uppercasing from asset creation and updated native asset checks
internal/serve/validators/wallet_validator.go Updated asset type inference to use case-sensitive comparisons
internal/serve/validators/wallet_validator_test.go Updated tests to verify case-sensitive asset code handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@philipliu philipliu temporarily deployed to Internal SEP Tests December 3, 2025 16:01 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) December 3, 2025 16:01 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@philipliu philipliu temporarily deployed to Internal SEP Tests December 3, 2025 16:05 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) December 3, 2025 16:05 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

Copy link
Contributor

@marwen-abid marwen-abid left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for being thorough with the fix.

@philipliu philipliu merged commit d477553 into develop Dec 3, 2025
15 checks passed
@philipliu philipliu deleted the philip/asset-code-casing branch December 3, 2025 18:39
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.

4 participants