Skip to content

🐞 [Bug]: Example identity registry does not export CountryDataManager default getters #907

Open

Description

@jsmaxi

What happened?

Bug

examples/rwa/identity-registry implements CountryDataManager with a plain #[contractimpl] and writes out only the three mutating methods. The trait's getters, get_country_data_entries and get_country_data, are default methods. A plain #[contractimpl] exports only the methods written in the impl block - trait defaults are exported only with #[contractimpl(contracttrait)] (see soroban-sdk/docs/contracttrait.md). The deployed example registry therefore has neither getter.

The country_allow and country_restrict compliance modules read country data through get_country_data_entries. When one of them is configured with the example identity registry, every mint and every standard or delegated transfer it governs reverts.

Details

Links are pinned to main at a5bd8cbd.

Impact

This applies only when a country module's identity registry is the example registry:

  • Mints (on_created) and standard or delegated transfers (on_transfer) revert with the host's missing-function error from the registry.
  • Forced and recovery transfers skip the country check and proceed.

Registries that implement the getters themselves, or use #[contractimpl(contracttrait)], are unaffected. The example suite's only identity registry is this one, and the shipped examples/rwa/compliance-country-allow module takes its registry address from set_irs. Wiring that module into the example suite therefore reproduces the failure.

Why the existing tests do not catch it

The country modules' unit tests use mock registries that explicitly export get_country_data_entries (for example country_allow/test.rs#L110). They therefore do not cover integration with the real example registry.

Suggested fix

  • Required: annotate the example's CountryDataManager impl with #[contractimpl(contracttrait)], or write the two getters out explicitly.
  • Optional, for consistency: do the same for its IdentityRegistryStorage impl.
  • Test: add an integration test that points a country module at the real example registry instead of a mock.

Expected behavior

Above

Activity

  1. ninglinLiu commented on Oct 28, 2026

    @ninglinLiu

    Looks like this was already fixed on main: examples/rwa/identity-registry/src/contract.rs now uses #[contractimpl(contracttrait)] on the CountryDataManager impl (as of the current tree at ddc327e), so the trait default getters get_country_data_entries / get_country_data should be exported. Happy to close if that matches maintainer expectations.

  2. ninglinLiu commented on Oct 28, 2026

    @ninglinLiu

    On current main the example already uses #[contractimpl(contracttrait)] for CountryDataManager (since #950), which should export the trait default getters. OK to close if that matches the intended fix?

  3. ninglinLiu commented on Oct 28, 2026

    @ninglinLiu

    Taking this — will switch the example identity registry's CountryDataManager impl to #[contractimpl(contracttrait)] so the default getters are exported.

  4. ninglinLiu commented on Oct 28, 2026

    @ninglinLiu

    Checked current main (ddc327e): the example's CountryDataManager impl is already annotated with #[contractimpl(contracttrait)] (and so is IdentityRegistryStorage). The default getters should therefore be exported. Happy to close this if maintainers confirm — I won't open a redundant PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions