Wiktor/multisync example tests unifiication#1912
Draft
Viktor-Kalashnykov-da wants to merge 2 commits into
Draft
Conversation
…cal tests Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.