Skip to content

Country data path: serialization inconsistencies & minor cleanup #529

@TaprootFreak

Description

@TaprootFreak

Severity

Low — consistency / cleanup, no active user-facing bug.

Findings

  • Triple country representation. The same country datum is serialized three different ways: registration top-level fields use the 2-letter symbol string; the standalone nationality step, kycData.address.country, and the settings address edit use the numeric id; RealUnitUserDataDto from the backend returns the symbol string (resolved app-side via getCountryBySymbol). There is no central serialization layer — each service method picks its own representation.
  • addressCountry serialized twice in the registration request. It is sent once as a symbol string top-level and once as {id} inside kycData.address.country (lib/packages/service/dfx/real_unit_registration_service.dart); the kycData copy is not covered by the EIP-712 signature.
  • Country.foreignName is dead. Loaded from the DTO and mapped onto Country, but never read anywhere in lib/. Either use it (e.g. localized display) or drop it.
  • lang hardcoded to 'DE' in the registration request (real_unit_registration_service.dart), despite a localized app and an existing DfxLanguageService. An English-speaking user is registered with lang='DE'.
  • displayOrder is loaded but never used. CountryField relies on the backend already sorting /v1/country; there is no local sort fallback. Note: the backend has no displayOrder column at all (see CountryDto: nationalityAllowed maps to an unused column; no DTO field exposes the real nationality gate DFXswiss/api#3755), so the field is effectively always its default — either sort locally or drop the field.
  • House number required inconsistently. Required in the onboarding address step but optional in the settings address edit, for the same datum.
  • Country equality is id-only (props => [id]). Fragile if two Country instances share an id but differ in other fields.

Context

Found during a deep audit of the KYC country/nationality data path (see #519). Backend-side counterparts: DFXswiss/api#3754, DFXswiss/api#3755.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions