Repository navigation
Description
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.
- The example's impl defines only
add_country_data_entries,modify_country_dataanddelete_country_dataunder a plain#[contractimpl]: contract.rs#L81-L106. - The getters are trait defaults at lines 578 and 592: identity_registry_storage/mod.rs#L572-L594. They became defaults in RWA:
Valfor country data instead assoc type #623, and the example was not updated to export them. - The module helper calls the getter on the token's configured registry: compliance/modules/storage.rs#L87-L97.
- Both country modules use it.
can_receivecalls the helper.on_createdalways checks, andon_transferchecksStandardandDelegatedtransfers but returns early forForcedandRecovery. See country_allow/storage.rs#L59-L115 and country_restrict/storage.rs#L50-L106. - The compliance contract calls module hooks directly, so a module failure reverts the token operation: compliance/storage.rs#L197-L241.
- Identity verification is unaffected. The example explicitly overrides both
IdentityRegistryStoragedefault getters,stored_identityandget_recovered_to.
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
CountryDataManagerimpl with#[contractimpl(contracttrait)], or write the two getters out explicitly. - Optional, for consistency: do the same for its
IdentityRegistryStorageimpl. - Test: add an integration test that points a country module at the real example registry instead of a mock.
Expected behavior
Above
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReview
Activity
ninglinLiu commentedon Oct 28, 2026
Looks like this was already fixed on
main:examples/rwa/identity-registry/src/contract.rsnow uses#[contractimpl(contracttrait)]on theCountryDataManagerimpl (as of the current tree atddc327e), so the trait default gettersget_country_data_entries/get_country_datashould be exported. Happy to close if that matches maintainer expectations.ninglinLiu commentedon Oct 28, 2026
On current
mainthe example already uses#[contractimpl(contracttrait)]forCountryDataManager(since #950), which should export the trait default getters. OK to close if that matches the intended fix?ninglinLiu commentedon Oct 28, 2026
Taking this — will switch the example identity registry's
CountryDataManagerimpl to#[contractimpl(contracttrait)]so the default getters are exported.ninglinLiu commentedon Oct 28, 2026
Checked current
main(ddc327e): the example'sCountryDataManagerimpl is already annotated with#[contractimpl(contracttrait)](and so isIdentityRegistryStorage). The default getters should therefore be exported. Happy to close this if maintainers confirm — I won't open a redundant PR.