Skip to content

fix(coins): resolve metadata race during concurrent coin activations#3454

Merged
CharlVS merged 11 commits intodevfrom
fix/metadata-race
Mar 23, 2026
Merged

fix(coins): resolve metadata race during concurrent coin activations#3454
CharlVS merged 11 commits intodevfrom
fix/metadata-race

Conversation

@CharlVS
Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS commented Mar 21, 2026

Summary

  • Rolls SDK submodule to GLEECBTC/komodo-defi-sdk-flutter#328 which adds a dedicated metadata mutex and updateActiveUserMetadataKey for atomic read-modify-write cycles on user metadata.
  • Batch-writes all asset IDs to wallet metadata in a single call before launching parallel activations, then passes addToWalletMetadata: false to avoid N concurrent writes that caused last-write-wins data loss.
  • Migrates addActivatedCoins / removeActivatedCoins to use the new updateActiveUserKeyValue API for atomic single-key transforms.

Test plan

  • Activate multiple coins simultaneously and verify none are dropped from the activated coins list
  • Deactivate coins and confirm the metadata list updates correctly
  • Restart the app and verify all previously activated coins are still present
  • Verify single coin activation/deactivation still works as expected

CharlVS added 2 commits March 21, 2026 18:32
Points to GLEECBTC/komodo-defi-sdk-flutter#328 which adds
mutex-protected atomic metadata updates to prevent concurrent
coin activations from overwriting each other's state.
Batch-write all asset IDs to wallet metadata in a single call before
launching parallel activations, then pass addToWalletMetadata: false
to avoid N concurrent read-modify-write cycles that caused
last-write-wins data loss.

Migrate addActivatedCoins/removeActivatedCoins to use the new
updateActiveUserKeyValue API for atomic single-key transforms.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

CharlVS added 2 commits March 21, 2026 18:35
Includes fix(auth): add mutex-protected atomic metadata updates (#328).
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 21, 2026

Visit the preview URL for this PR (updated for commit 47fac14):

https://walletrc--pull-3454-merge-w78t3405.web.app

(expires Mon, 30 Mar 2026 13:17:18 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

CharlVS added 7 commits March 23, 2026 12:46
Resolve conflict in kdf_auth_metadata_extension.dart by keeping
the atomic updateActiveUserKeyValue calls (race condition fix) over
the non-atomic setOrRemoveActiveUserKeyValue from dev.

SDK submodule fast-forwarded to 317719d which includes both #328
(mutex-protected metadata updates) and #329 (reified generics in
JSON traversal for WASM/minified builds).
The merge from dev picked the fix/metadata-race side's SDK pointer
(9532870, #328 only) instead of dev's pointer (317719d) which also
includes #329 — the reified generics fix for _traverseJson that
prevents valueOrNull<List<String>> from silently returning null
in WASM/minified release builds.
Points to fix/trezor-test-missing-method (ea99ec6) which adds the
missing updateActiveUserMetadataKey stub to _FakeAuthService in
trezor_auth_service_test.dart.
Includes #328 (atomic metadata updates), #329 (reified generics for
WASM), and #330 (trezor test compilation fix).
Points sdk at 869dd00 (komodo-defi-sdk-flutter dev), including PR #331.
@CharlVS CharlVS merged commit ab67ff1 into dev Mar 23, 2026
4 of 11 checks passed
@CharlVS CharlVS deleted the fix/metadata-race branch March 23, 2026 13:12
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