Skip to content

Wiktor/multisync example tests unifiication#1912

Draft
Viktor-Kalashnykov-da wants to merge 2 commits into
wiktor/multisync-examplefrom
wiktor/multisync-example-tests-unifiication
Draft

Wiktor/multisync example tests unifiication#1912
Viktor-Kalashnykov-da wants to merge 2 commits into
wiktor/multisync-examplefrom
wiktor/multisync-example-tests-unifiication

Conversation

@Viktor-Kalashnykov-da
Copy link
Copy Markdown

Unify single-sync and multi-sync tests
This PR makes example scripts and tests work correctly in both single-synchronizer and multi-synchronizer (multi-sync) environments by teaching the SDK and test harness to pick the right synchronizer automatically, and collapses the previously separate multi-sync test pipeline into a single job.

Problem
In a multi-sync localnet (where both a global/global-domain synchronizer and an app-synchronizer are connected), the SDK was defaulting to whichever synchronizer appeared first in the /v2/state/connected-synchronizers response — often the app-synchronizer. This caused external party creation and transaction preparation to target the wrong domain, breaking scripts 01–15 when run against the multi-sync stack.

Changes
Synchronizer selection logic (ledger-client, wallet-sdk, utils/index.ts):

getSynchronizerId() / getDefaultSynchronizerId() now prefer synchronizers aliased global or global-domain over application-specific ones, falling back through non-app-synchronizer → first as a last resort.
resolveGlobalSynchronizerId() utility gains the same global-domain and non-app-synchronizer fallbacks.
External party creation (service.ts, signed.ts):

ExternalPartyNamespace.resolveSynchronizerId() now delegates to ctx.defaultSynchronizerId (already resolved at SDK init) instead of performing its own lookup.
Party hint defaults to a UUID (v4()) instead of an empty string when not provided.
Example scripts (01, 09, 10, 14) and snippets setupTests.ts:

All external party creation calls now explicitly pass synchronizerId: globalSynchronizerId and additionalSynchronizerIds so parties land on the correct synchronizer in both single-sync and multi-sync environments.
setupTests.ts also detects the app-synchronizer at runtime and passes it as an additional synchronizer ID where needed.
Test runner (scripts):

Removed test-multi-sync-scripts.ts (separate multi-sync runner) and the script:test:examples:multi-sync package script — script:test:examples now covers all scripts including 15-multi-sync.
CI (build.yml):

wallet-sdk-scripts-e2e: switched to multi_sync: 'true', added DPM cache restore, featured DAR generation, and DAML-dependent package rebuilds.
Removed the wallet-sdk-multi-sync-e2e job.
test-wallet-sdk-e2e updated to no longer depend on the removed job.

…cal tests

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
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.

1 participant